The two main rivals vying to succeed Angela Merkel as German chancellor on Sunday each said they would try to head the next government after early election results showed them neck-and-neck, kickstarting a scramble for potential coalition partners.
Germany's chancellor is not directly elected, but chosen through a vote in the Bundestag, the lower house of parliament, after a government has been formed. Merkel could remain in her post for weeks if not months while parties try to cobble together a coalition.
After years of two-party coalitions, three parties will likely be needed this time to achieve a majority -- common in Germany's regional parliaments but not seen at the national level since the 1950s.
In most parliamentary systems, the head of state nominates a party to form a government -- usually the party that has won the biggest share of the vote.
But in Germany, all parties can embark on what are known as "exploratory talks".
In this initial phase, which has no time limit, there is nothing to stop the parties from all holding coalition talks in parallel -- though tradition dictates that the biggest party will invite smaller ones for discussions.
But Armin Laschet, the chancellor candidate from Merkel's centre-right CDU-CSU bloc, on Sunday said the conservatives would "do everything we can" to lead the next government, even after preliminary results put them a touch behind the centre-left Social Democrats (SPD).
His SPD rival Olaf Scholz, the country's finance minister, said voters wanted a change and for "the next chancellor to be called Olaf Scholz".
The Greens have already called a party congress for Saturday October 2, during which they could decide with whom they would take up exploratory talks.
Discussions will begin as soon as the results are in, with the parties looking to discover each other's red lines and establish whether they can work together.
On Monday, the day after the election, the parties will hold leadership meetings. The newly elected MPs from each party will also hold their first meetings next week, with the SPD and CDU-CSU planning to convene on Tuesday.
The pro-business FDP party, which like the Greens could play a kingmaker role, has said it has a preference for a coalition with the conservatives and the Greens, but a three-way alliance with the SPD and Greens remains on the table too.
The newly elected parliament must hold its inaugural session no later than 30 days after the election, on October 26.
Thrashing out details
If two or three parties agree in principle that they would like to form an alliance, they must then begin formal coalition negotiations, with various working groups meeting to thrash out policy issues.
At the end of these negotiations, the parties decide who will be in charge of which ministry and sign a coalition contract, a thick document setting out the terms of the agreement.
This phase also has no time limit, with the outgoing government holding the fort in the meantime.
The parties then nominate who they would like to be chancellor before the official vote in the Bundestag.
After Germany's last election on September 24, 2017, Merkel was formally confirmed chancellor in a coalition between the CDU-CSU and the centre-left Social Democrats (SPD) only on March 14, 2018.
According to Article 63 of the German constitution, the head of state must propose a potential chancellor to the Bundestag.
If no cross-party alliance emerges, President Frank-Walter Steinmeier of the SPD may still nominate a potential chancellor, most likely from whichever party won the biggest share of the vote.
The parliament will then vote in a secret ballot, with the candidate needing an absolute majority.
If this is not achieved, a second vote will be held two weeks later. If there is still no absolute majority, there is then an immediate third vote in which a relative majority is enough.
The president then decides whether to appoint the chancellor as head of a minority government, or to dissolve the Bundestag and call new elections.This worst-case scenario was narrowly avoided in 2017: faced with an impasse in negotiations, Steinmeier urged the parties to meet again, pushing for the renewal of the so-called grand coalition.