By GEIR MOULSON and DAVID RISING, Associated Press

BERLIN (AP) — Angela Merkel set off Monday on what could be a three-year countdown to the end of her leadership of Germany, a stint that has made her the European Union's longest-serving leader and a key figure in facing the continent's many crises.

Merkel announced that she will give up the leadership of her conservative Christian Democratic Union in December and won't stand for a fifth term as chancellor — signaling the beginning of the end at the helm for the woman many had labeled the "leader of the free world."

That's a title she herself objected to, saying leadership is never up to one person or country. But she has been a stalwart face of Western democracy through turbulent times, including the European debt crisis, the migrant influx of 2015, Britain's decision to leave the EU and escalating trade tensions with the United States.

With her announcement, she indicated she has no intention of shirking from the "major foreign policy challenges" ahead, suggesting by taking the question of her future out of the picture her often rancorous coalition might govern better.

"With this decision, I am trying to contribute to allowing the government to concentrate its strength, finally, on governing well — and people rightly demand that," Merkel said.

Merkel, 64, has led the CDU since 2000 and Germany since 2005. She governs Germany in a "grand coalition" of what traditionally has been the country's biggest parties — the CDU, Bavaria's conservative Christian Social Union and the center-left Social Democrats.

She announced her decision the day after voters punished both her CDU and the Social Democrats in an election in the central state of Hesse. It came two weeks after a similar debacle for the CSU and Social Democrats in neighboring Bavaria.

Her announcement comes amid growing concerns about far-right nationalist parties making inroads in Europe, including Germany. Sunday's result in Hesse means that the Alternative for Germany party now holds seats in every state legislature and federal parliament.

Many in Europe also have looked to Merkel as U.S. President Donald Trump has increasingly called into question traditional trans-Atlantic ties with his announcements of trade tariffs, repeated criticism of European contributions to NATO, and other issues. Merkel has walked a fine line, criticizing some of Trump's decisions while emphasizing that a good relationship with Washington is "central" to her government.

At the moment, it is still too early to tell whether she will be able to govern effectively as a lame-duck chancellor, or if it will strengthen her coalition, said Thorsten Faas, political science professor at Berlin's Free University.

"The pressure obviously was so great that there was no other solution left," he said. "It will be interesting to see what happens now, because this is initiating a dynamic, the outcome of which is unforeseeable today."

For her part, Merkel said she sees "many more opportunities than risks for our country, the German government and also my party" in setting a transition of power in motion.

She said she hopes to open the way for "new success for the CDU" by letting it prepare for her departure as chancellor, and she won't interfere with the choice of a successor.

Carsten Brzeski, an economist at ING-DiBa in Frankfurt, said Merkel's move "holds the potential for positive developments."

"Not so much because new is always better but rather because it could give Merkel the freedom and the tail wind — freed from party ties — to put a final stamp on her legacy, possibly with bolder steps to reform the German economy and the monetary union," he said.

Merkel will now concentrate on smoothing over the differences in her government to keep it running until the end of the parliamentary term in 2021, which is far from guaranteed. The Social Democrats only reluctantly joined her coalition in March, and another crisis or an already-agreed midterm review next fall could spell its end.

The Social Democrats' leader, Andrea Nahles, said she hopes the CDU leadership contest will end arguments within Merkel's bloc about its direction and leaders. If things go well, "it could have a positive effect for us and our work together."

Two prominent candidates immediately threw their hats in the ring: Annegret Kramp-Karrenbauer, 56, the party's general secretary, who is viewed as a Merkel ally and largely backs her centrist approach; and Health Minister Jens Spahn, 38, an ambitious conservative who has talked tough on migration and has criticized Merkel.

Another more conservative figure, Friedrich Merz, also reportedly planned to seek the leadership. Merz lost his post as the party's parliamentary leader to Merkel in 2002 and has been absent from front-line politics in recent years.

It had been widely assumed this would be Merkel's final term in office, but the comments were the chancellor's first public confirmation.

Merkel's predecessor, Gerhard Schroeder, stepped down as leader of his Social Democrats in 2004 but remained chancellor until narrowly losing a re-election bid 18 months later.

Merkel said she has been mulling her decision for months. Her one-time mentor, Helmut Kohl, sought a fifth term in 1998 and lost power after 16 years.

Merkel has dragged the CDU to the political center, dropping military conscription and abruptly accelerating the shutdown of Germany's nuclear power plants following Japan's Fukushima disaster in 2011.

She swung her conservatives behind bailouts for Greece and other struggling eurozone nations, striking a balance between calls for a strict approach at home and more generosity abroad.

In one of her most debated moves, Merkel allowed large numbers of migrants and asylum-seekers into Germany in 2015, many of them fleeing the fighting in Syria, before gradually pivoting to a more restrictive approach.

That decision has led to lasting tensions in her conservative Union bloc, particularly with Bavaria's CSU, and helped the anti-immigrant Alternative for Germany party gain support. At the other end of the spectrum, the traditionally left-leaning Greens also have gained.