The leader of Spain's main opposition Socialists, Alfredo Perez Rubalcaba, announced Thursday that he is leaving politics after more than two decades in Parliament and a succession of Cabinet posts under two prime ministers.

A day after the May 25 elections for the European Parliament, in which the Socialists fared poorly, the 62-year-old Rubalcaba said he would step down as party leader and called an internal election for the end of July to choose a successor.

Rubalcaba said Thursday that will resign his seat in Parliament in September and return to teaching.

There is no office "more important, relevant and gratifying" than that of legislator, he said, addressing his colleagues.

Rubalcaba has served as minister of education and interior and spent several months as deputy premier under Prime Minister Jose Luis Rodriguez Zapatero.

He was the Socialists' standard-bearer in the November 2011 general elections, which saw the party suffer one of its worst-ever defeats amid a severe recession.

Rubalcaba, who holds a PhD in chemistry from Madrid's Universidad Complutense, taught at that institution as well as at universities in Germany and France. EFE