PARIS (AP) — French voters dealt a severe blow to the Socialist government in Sunday’s municipal elections, but the party saved face by retaining the crown jewel, Paris, which got its first female mayor.

The anti-immigration far right, which claims that France’s large Muslim population is “Islamicizing” the nation, made solid advances, fulfilling National Front promises to begin building a grassroots base.

Socialist leaders conceded defeat in the final round of the voting seen as a referendum on unpopular President Francois Hollande, who was expected to reshuffle the Cabinet in an effort to give the government a boost. Hollande has earned record-low poll ratings for his failure to cure France’s flagging economy or cut into the jobless rate, which hovers around 10 percent.

Interior Minister Manuel Valls announced deep losses for his Socialist Party, saying it lost to the mainstream right some 50 cities of more than 30,000 it had held previously, and about 155 towns and cities of all sizes. Toulouse, France’s fourth-largest city, moved to the right.

The far right may win up to 15 towns in the voting, Valls said before results were complete. Party leader Marine Le Pen said the performance amounted to “an incontestably great success” that will give her National Front more than 1,200 local councilors — surpassing her goal.

“This vote is a defeat for the government and the (Socialist) majority,” said Prime Minister Jean-Marc Ayrault. “This message is clear … The president will draw conclusions, and he will do so in the interest of France,” he added, in a clear reference to a Cabinet reshuffle. It was unclear when a new government might be announced, or whether Ayrault would keep his job.

Paris also gets a new look, as Anne Hidalgo defeated conservative right candidate Nathalie Kosciusko-Morizet. Hidalgo, 54, spent 13 years as deputy to outgoing Mayor Bertrand Delanoe. She was able to profit from popular programs he initiated such as the Velib bike-sharing and Autolib auto-sharing services, and the creation of a beachfront each summer on the banks of the Seine.

“I am the first woman mayor of Paris. I am aware of the challenge,” Hidalgo said in a victory speech.

The Socialists also managed to save Lyon, France’s third-largest city, from the conservative right UMP party of former President Nicolas Sarkozy, as well as large cities like Strasbourg and Montpellier. Significantly, the Socialists took the southern town of Avignon from the UMP and prevented a far-right victory in the town known worldwide for its summer theater festival.

Le Pen’s National Front was using the two-round elections to sink local roots around France in view of national voting, including the 2017 presidential vote and May’s European parliamentary elections. The party won the blighted northern town of Henin-Beaumont in last week’s first round.

The far right took the Cote d’Azur town of Frejus and notably won the 7th district of Marseille, France’s second-largest city with a large percentage of residents of immigrant origin, many from Muslim North Africa. The district’s population is about 150,000 — the party’s biggest win.

However, Marseille stayed in the hands of conservative right Mayor Jean-Claude Gaudin.

Le Pen said her party has ended “bipolarization” of French politics in which the traditional right and left divvy up votes.

“A third political force has been born,” she said, adding that the party, which wants France to withdraw from the European Union, would begin campaigning immediately for elections for the European Parliament, where she is a deputy.

Le Pen’s father, National Front founder Jean-Marie Le Pen, shocked France and the world in the 2002 presidential vote when he faced off against incumbent President Jacques Chirac.

___

Greg Keller in Paris contributed to this report.