The National Front, a far-right party that has attempted to rebrand itself as a populist and nationalist alternative to traditional parties on the left and right, made significant gains on Sunday, taking control of 11 cities and winning seats on municipal councils in many more.

Local politics have largely been dominated by the Socialist Party for at least a generation, but the elections on Sunday appeared to reverse that trend. Le Monde, the respected newspaper of the center-left, ran a front-page photograph of a somber-looking Mr. Hollande on Monday with a headline that claimed a “historic rout.” Le Figaro, a newspaper of the right that has been unceasingly critical of the president, contended that a conservative “tsunami” was “washing over Mr. Hollande.”

One bright spot for the Socialist Party was in Paris, where its candidate, Anne Hidalgo, was elected the first female mayor.

Mr. Hollande narrowly won the presidency in 2012 with promises of a speedy return to economic prosperity and reinforced social protections. But he quickly lowered his ambitions and said he had underestimated the dire state of France’s public finances. More recently, he was unable to make good on a pledge to stop the rise in unemployment by the end of 2013.

The disenchantment among voters, analysts say, stems from frustration with unkept promises and a seeming lack of direction from Mr. Hollande that has been criticized even within his own camp.

“For several months, there has been a lack of explanation, of pedagogy, with regards to the people,” said François Rebsamen, a Socialist senator and mayor, and a close friend of Mr. Hollande’s. The president “needs to give his vision, say where we stand, where we’re going,” Mr. Rebsamen told Radio Classique. “It’s this lack of direction that is so undermining for the political efforts that are being carried out.”

Mr. Ayrault, the outgoing prime minister, was viewed by voters and commentators alike as a bit bland and lacking energy. By contrast, Mr. Valls is intense and sometimes fiery. There has been little indication, however, that the change in leadership will be much more than cosmetic, and most policies are expected to remain the same, with the exception of the future tax cuts announced Monday. Other members of the new government have yet to be announced.