- German federal election 2021
image source, Reutersimage captionThe election banners are being packed away, but a lot of work lies ahead to form Germany's new government
The polls have closed and Germany's centre-left Social Democrats (SPD) have claimed a narrow victory in the federal election.
Now, the complicated process of forming a coalition government begins.
SPD leader Olaf Scholz wants to work with the Greens and liberals and says they have a public mandate to do so. But his conservative rival Armin Laschet will not give up that easily.
The talks can take months. Until then, Angela Merkel will remain in office.
So Germany voted – what happened?
Germans went to the polls on 26 September. It was a significant election because the new chancellor will replace Angela Merkel, who has spent 16 years at the helm.
It was an extremely tight race – but no party won enough votes to form a majority in the Bundestag, Germany's parliament.
That means that a coalition government must be formed. This is nothing new for Germany, as since the Second World War no party has ever won enough seats to form a government on its own.
- SIMPLE GUIDE: What you need to know about Germany's election
Olaf Scholz's SPD party claimed victory – but he will need to join forces with other parties if he wants to secure the chancellery.
The other leading party, Chancellor Merkel's conservative Christian Democratic Union (CDU) suffered its worst-ever performance with Armin Laschet as its candidate.
The SPD and conservatives have governed together for years. However, Mr Scholz has said he wants to join forces with the Greens and liberal Free Democratic Party (FDP).
But the conservatives are not going down without a fight. Armin Laschet has said he is determined to try to form a government, also with the Greens and liberals. But his reputation has taken a hit this year, particularly after he was pictured laughing during a sombre visit to a flood-hit town in July.
media captionSwipe left or right? Germany's election dating game, explainedNow comes the tricky part…
Negotiations to form a joint government are probably the most difficult and complicated process after a federal election.
They can take months – and even then they are not always successful. One example is the election in 2017, when there was a failed attempt to form a three-way government with the CDU, Greens and FDP.
In Germany's political system, all parties are allowed to hold "exploratory talks" – an initial phase where everyone can negotiate at the same time. It is an early chance for politicians to determine if they can work together despite ideological differences.
The Greens and FDP are the kingmakers in this election. Both leading parties want to join forces with them, and will be trying to woo them.
A "grand coalition" is also an option, and would see the two biggest parties join forces once again as they are now. But Olaf Scholz and Armin Laschet both have their eyes on being chancellor, so this option is less likely.
Once the parties decide a coalition is possible, they will dive into the detail during negotiations.
Every point is thrashed out until they agree on things like policy issues and ministerial appointments.
Once they have reached a common ground and signed a thick blueprint of terms and agreements, they can then nominate their pick for chancellor before the official vote in the Bundestag.
After Germany's last election in 2017, it took more than five months before Angela Merkel was formally confirmed as chancellor.
Retiring Merkel remains in office
While the negotiations crawl along, the outgoing government stays in place to look after things. This means Angela Merkel will remain in office in a caretaker capacity.
Mrs Merkel has said she is looking forward to retirement, but she could still be working at Christmas. In fact, she will become Germany's longest-serving chancellor if she is still there on 17 December, beating the record held in recent times by Helmut Kohl.
- GALLERY: Angela Merkel: A career in pictures
- LEGACY: EU's queen with a tarnished crown
- ANALYSIS: How Germans will look back on Angela Merkel
It also means that she may go to Rome at the end of October for the annual G20 summit, and meet up with many of the world leaders who have already bid her adieu.
image source, Getty Imagesimage captionAngela Merkel backed Armin Laschet as her successor, but the party suffered its worst-ever performanceWhat is the worst-case scenario?
If a government cannot be formed, another election could be called. But to maintain political stability, it is more likely Germany's President Frank-Walter Steinmeier will encourage the parties to make a deal.
If they are unable to agree on a chancellor, Mr Steinmeier, who is a Social Democrat, can step in again to nominate a potential leader, usually from the party which won the most votes.
Parliament then votes in a secret ballot, with the candidate needing an absolute majority (more than half of the votes).
If the impasse continues after another two rounds of voting, the president can appoint the chancellor as head of a minority government, or move to dissolve the Bundestag and call fresh elections.