Germany's Angela Merkel has said she will step down as chancellor in 2021, following recent election setbacks.
"I will not be seeking any political post after my term ends," she told a news conference in Berlin.
She also said she would not seek re-election as leader of the centre-right CDU party in December. She has held the post since 2000.
The CDU was severely weakened in Sunday's poll in the state of Hesse, the latest in a series of setbacks.
Both the CDU and its national coalition partners, the Social Democrats, were 10 percentage points down on the previous poll there.
The election comes just weeks after Mrs Merkel's Bavarian sister party, the CSU, suffered huge losses in a state parliament vote.
■ Chancellor Merkel: Germany's shrewd survivor
■ Merkel's three challenges
■ Angela Merkel's leadership woes
Parties like the left-leaning Greens and the far-right, anti-immigration AfD have grown in national support following the 2017 general election, as backing for the major centre parties has waned.
Merkel's long goodbye
By Jenny Hill, BBC's Berlin correspondent
Angela Merkel did her best to maintain her famous poker face but at times she looked rather sad as she announced what amounted to an official - albeit drawn-out - farewell to German politics.
She has always insisted that if she is to lead Germany, she must also lead her party.
The announcement is intended to silence critics in her party and win back the voters who have deserted the CDU in favour of parties like AfD and the Greens, but it also reflects her dwindling grip on power.
Much depends on her successor as party leader. If it is a loyalist - like Annegret Kramp-Karrenbauer - Germany might see a smooth transition to a new chancellor, possibly allowing Mrs Merkel to see out her term.
But the vultures are circling. Already an old rival, Friedrich Merz, has announced his candidacy. If one of Mrs Merkel's adversaries prevails as party leader, her chancellorship becomes uncomfortable and possibly untenable.
What did Mrs Merkel say?
Mrs Merkel said she took "full responsibility" for poor performance.
"As chancellor and leader of the CDU I'm politically responsible for everything, for successes and for failures," she said.
"When people are telling us what they think of how the government was formed and what they think of our work during the first seven months of this parliament... then it is a clear signal that things can't carry on as they are.
"The time has come to open a new chapter."
She also made it clear she would not handpick her successor as party leader and would "accept any democratic decision taken by my party".
Who is likely to succeed her as party leader?
Annegret Kramp-Karrenbauer would be the obvious choice for Merkel loyalists to replace her. She is currently the party secretary.
However, Health Minister Jens Spahn, a leading critic of the chancellor's open-door migration policies, has also announced his candidacy.
And Friedrich Merz, a former leader of the CDU-CSU parliamentary group and an old rival to Mrs Merkel, has thrown his hat into the ring.
What has been happening in regional elections?
Mrs Merkel's CDU plunged 11 percentage points to 27% in Sunday's elections in the central state of Hesse, according to preliminary results. This was the party's worst showing in the state since 1966.
The SPD, which is in coalition with the CDU nationally, fell by a similar amount to 19.8%.
The main beneficiaries were the Greens, who paradoxically share power with the CDU in the state and have now drawn level with the SPD, and the far-right AfD, who rose to 13%.
The Hesse vote follows a pattern of losses for the two main parties, with the AfD doing particularly well in eastern states.
Also on 14 October, the CDU's Bavarian ally, the CSU, lost its absolute majority in the state's parliament which it has dominated since 1957. Like in Hesse, the SPD also lost badly and the Greens and AfD surged.
While the Greens appear to have benefited from the SPD's slump in support, it seems clear that the centre-right has lost voters to the AfD.
Part of the reason could be anger at Mrs Merkel's decision to open Germany's borders to large numbers of migrants, a move which the AfD has vehemently opposed.