French President Francois Hollande approved a new cabinet Wednesday that includes his ex-companion Segolene Royal as minister of environment and energy.

The new government was named after discussions between new Prime Minister Manuel Valls and Hollande, and follow a crushing defeat for their Socialist Party in municipal voting last week.

Royal's return to government follows a long period in the political wilderness. She ran an unsuccessful campaign for the presidency in 2007, losing to Nicolas Sarkozy. She was overlooked for a spot in the Socialist government that took office after Hollande's presidential victory in 2012, despite having served as minister for education and family in governments under Francois Mitterrand.

Laurent Fabius and Jean-Yves Le Drian keep their positions as foreign affairs and defence ministers in the new government. Former Finance Minister Pierre Moscovici has left the government and the brief has been split between two Socialists: Michel Sapin will take charge of finance, and Arnaud Montebourg will be in charge of industry and economy.

The government shakeup was expected after Hollande's Socialist party suffered big losses in nation-wide voting for mayors and city counsellors last week. Voters turned against the Socialists amid disillusionment with Hollande's inability to keep campaign promises to bring down record unemployment and turn around the economy.

Francois-Hollande-ladies

At left, the French president's official partner, Valerie Trierweiler. At right, actress Julie Gayet, with whom he is rumoured to have been having an affair. (Reuters)

Royal's return to government has been called a spectacular comeback and a sign of political rapprochement with her former partner. She is mother to his four children.

Hollande's complex personal life grew more so in January when he split with the country's first lady two weeks after a tabloid reported that he was having an affair with an actress. Hollande was ending his seven-year relationship with Valerie Trierweiler, the successor to Royal.

With files from CBC News