French ex-prime minister Manuel Valls said on Tuesday that he was quitting the Socialist Party and would be allied with President Emmanuel Macron’s centrist group, in another humiliation for the former ruling party.

“Part of my political life is coming to an end. I am leaving the Socialist Party, or the Socialist Party is leaving me,” the 54-year-old told RTL radio.

Mr. Valls said he would now be part of the presidential “majority” in the National Assembly led by Macron’s Republic on the Move (REM), although the party has ruled out the possibility of Mr.Valls taking a leading role.

Mr. Valls, who was prime minister under Socialist president Francois Hollande from 2014 to 2016, was rejected by Socialist voters in the party’s primary to choose a candidate for this year’s presidential election.

The party chose hard-left candidate Benoit Hamon over the reform-minded Mr. Valls but Mr. Hamon failed to reach the run-off of the presidential election in May, with France’s two big traditional parties both falling at the first hurdle.

Mr. Macron’s party won a commanding majority in the legislative election that followed, completing the president’s transformation of the French political landscape.

The Socialists were humiliated, losing over 200 seats after five years in power overshadowed by sluggish economic growth and high unemployment.

Mr.Valls said Tuesday he felt “sad and bitter... at what the PS has become“. He had approached REM about running for the party in the legislative election but was rebuffed.

An arrangement was eventually agreed under which REM did not field a candidate against him in the southern Paris suburbs, allowing him to retain his seat.

The pugnacious, Spanish-born Mr. Valls was Mr. Macron’s boss when the now-president was economy minister and a fierce rivalry developed between them over his presidential ambitions.

Mr. Valls oversaw Hollande’s attempt to liberalise economic policy and his decision to ram through reforms of the labour market without a parliamentary vote were deeply unpopular with the left of the party.

The labour reforms sparked months of street protests last year. Government spokesman Christophe Castaner said his decision to leave the Socialists was “not a surprise“.

“There is something very harsh about Manuel Valls’ situation. There are criticisms that could be made against him, but I think there is an opprobrium towards this man that doesn’t seem fair to me,” he added.

Castaner said Valls would not have “a top role — he doesn’t want one and the new generation of Republic on the Move would not welcome it“.

A parliamentary source said that while Valls would not be an REM lawmaker, he would enjoy the status that such a role would bring, such as having speaking time in debates.