Prime Minister Élisabeth Borne of France resigned on Monday ahead of a widely expected cabinet reshuffle by President Emmanuel Macron, as he attempts to inject new energy into his presidency at the start of a year of major events in France, including European Parliamentary elections and the Summer Olympics in Paris.

Ms. Borne, 62, was appointed as prime minister shortly after Mr. Macron’s election to a second term in May 2022, and is only the second woman to occupy that position.

But her time in office has been marked by political and social unrest — from anger in the streets and in Parliament over a pension overhaul to riots over the police shooting of a teenager — and Mr. Macron has appeared increasingly intent on appointing a fresh face.

Mr. Macron’s office said he had accepted Ms. Borne’s resignation, little more than a formality given his widely reported desire to replace her. Ms. Borne will continue to handle “current affairs” until a new cabinet is appointed, the office said.

“You carried out our project with the courage, commitment and determination of stateswomen,” Mr. Macron said. “Thank you from the bottom of my heart.”

In her resignation letter, which was shared with the French news media, Ms. Borne made it clear that it was Mr. Macron who had decided to replace her, and she suggested she would have preferred to stay on. She noted that her government had passed over 50 bills in Parliament and that it was “more than ever necessary” to reform France.

“At a time when I must present my government’s resignation, I wanted to tell you how passionate I have been about this mission, guided by our shared concern to achieve rapid, tangible results for our fellow citizens,” she wrote.

Prime ministers play an important role in France. Under the Constitution, it is through their leadership that the government “determines and conducts the nation’s policies.” They are directly accountable to Parliament — Ms. Borne survived scores of attempts by lawmakers to topple her — and they oversee much of the domestic day-to-day running of the country.

But presidents occupy a much more powerful office, with exclusive prerogatives over foreign policy, and the government’s agenda is usually theirs. France’s presidents are elected directly by a popular vote every five years, and they often view their prime ministers as close collaborators or subordinates, not autonomous policymakers.

Mr. Macron is expected to appoint Ms. Borne’s replacement on Tuesday morning.

Several of his current or former ministers have emerged as contenders in recent days, including Sébastien Lecornu, his defense minister; Julien Denormandie, Mr. Macron’s former agriculture minister, who helped him start his political movement; and Gabriel Attal, another longtime ally who is currently education minister.

A stern but hard-working technocrat and daughter of an Auschwitz survivor who rarely talked about her personal life, Ms. Borne loyally and dutifully carried out Mr. Macron’s agenda.

She spent 20 months on the job, twice as much as Édith Cresson, the only other woman to hold the position, from May 1991 to April 1992, and she shepherded through Parliament dozens of Mr. Macron’s bills, including to shield French consumers from inflation, tighten unemployment benefit rules or develop nuclear energy.

But Ms. Borne was forced to work with a fractured lower house of Parliament, where Mr. Macron’s centrist alliance does not control an absolute majority, causing serious headaches for his policy ambitions.

Ms. Borne was nicknamed “Madame 49.3” in the French news media in reference to the constitutional tool that she used on more than 20 occasions during her time in office to pass bills in the lower house without a vote — mainly budget measures, but most notably the widely unpopular pension overhaul, which raised the legal age of retirement.

More recently, Ms. Borne had to compromise with right-wing conservatives on a tough immigration law that put her government on the back foot and rankled some of her own ministers, leading one to resign.

The episode raised questions about her ability to navigate Parliament and set off weeks of speculation that Mr. Macron would change his cabinet after the new year.

Ms. Borne was Mr. Macron’s first left-leaning prime minister, after several years as a low-key member of his cabinet, as transportation, environment and, finally, labor minister.

On Monday, a few opponents praised her as a trailblazer. Valérie Pécresse, who ran as a right-wing candidate against Mr. Macron in the 2022 elections, thanked her on social media “for embodying feminine power with dignity and courage.”

But many others criticized her for following Mr. Macron to a fault.

“Élisabeth Borne served Emmanuel Macron to the point of losing herself,” Cyrielle Chatelain, a top Green lawmaker, said on social media.