Updated

Germany's Social Democratic Party said Sunday its members have voted in favor of joining a coalition with Angela Merkel's conservative bloc, clearing the last major hurdle to the formation of a new government and a fourth term for the veteran German chancellor.

The decision ends almost six months of uncertainty in German politics, the longest the country has been without a government in its post-war history.

The center-left Social Democrats had furiously debated whether to extend the so-called grand coalition for another four years after suffering a slump in September's election. In the end, two-thirds of the valid votes cast by its 464,000 members favored a coalition deal, said party treasurer Dietmar Nietan, who oversaw the ballot.

"This was a really important democratic decision for our country," acting party leader Olaf Scholz told reporters in Berlin. The Social Democrats will put forward six names — three women and three men — to lead the ministries they will control in the upcoming coalition in the coming days, he said.

"This was a really important democratic decision for our country."

— Olaf Scholz, acting leader of Germany's Social Democrats

Parliament is expected to meet next week to elect Merkel as chancellor.

Activists at the Social Democrats' headquarters in Berlin had worked through the night to count the votes. A "no" vote would have been a blow for the party's leadership — who campaigned for members' approval — and for Merkel, who spent months negotiating with rival parties to form a new government.

After September's election, in which the Social Democrats received just 20.5 percent of the vote, then-leader Martin Schulz ruled out another grand coalition with Merkel. This forced Merkel to negotiate with two smaller parties, one of which eventually rejected a deal.

Frank-Walter Steinmeier, president of Germany

Frank-Walter Steinmeier, president of Germany (Associated Press)

Pressure from German President Frank-Walter Steinmeier prompted Schulz to rethink and weeks of haggling between his party and Merkel's bloc resulted in a coalition agreement. Fewer Social Democrats approved the deal this time round than in 2013, when 76 percent of members backed a government with Merkel.

Many Social Democrats, particularly on the left, had argued that the party failed to make its mark on the last government and wouldn't benefit from propping up Merkel for another term.