FOUR years after they left office, Lithuania's Social Democrats are back. In the second round of the parliamentary elections the party won 38 seats in the 141-seat parliament. Their leader Algirdas Butkevičius looks set to be the next prime minister.

But at the head of what government? The obvious partners are the Labour party (Darbo partija) with 29 seats and the Order and Justice party (Tvarka ir teisingumas) with 11. Having held preliminary talks after the first-round elections on October 14th, the three parties met again after the second-round result and Mr Butkevičius confirmed that they had agreed to form a coalition.

Politics is not mere arithmetic, however. In the eyes of much of the political establishment, including the country's formidable president, Dalia Grybauskaitė, Labour is not fit for government.

A big reason is a scandal about vote-buying In one constituency the results were annulled because of this. Other allegations of electoral wrongdoing abound, including an ongoing criminal case involving party finances. The party itself, three of its top members and its former accountant are accused of tax evasion and false documentation. The party has tried hard to keep the cases out of court. Next year the proceedings would fail under the statute of limitations. But on the eve of the second-round vote the prosecutor upped the charges from tax evasion to fraud. That prolongs the time-frame in which the case can be heard and increases the possible penalty. The party leader, Victor Uspaskich, could face eight years in prison. He and all the others vehemently deny all wrongoing.

The Social Democrats have been in coalition with Labour before, following the 2004 elections. But that lasted only for a year and half and left unpleasant memories. Mr Uspaskich, then the minister of the economy, was involved in another scandal about European Union money which (it was alleged) ended up in companies to which he had personal links: he denied this. The authenticity of his university diploma also came under scrutiny: he insisted it was genuine. When the investigation into his party’s book-keeping started he fled to Moscow. Many fear that Labour, once in government, would try to use its political clout to have the cases dropped. (Labour politicians deny that they would ever interfere in the administration of justice in this way).

Mr Uspaskich had hopes of being prime minister. But his party's slightly disappointing second-round results seem to have calmed his ambitions. He is now talking of four to five ministers for his party in a putative coalition government.

Even that may be tricky. The constitution gives Ms Grybauskaitė the lead in choosing who should form a government. On Monday morning she met the conservative leader and outgoing prime minister Andrius Kubilius, and then Mr Butkevičius. She said she would advise the Social Democrats to form the government, but she would support only a political force that can form a majority without the Labour party.

"Forming the government should not involve a party which is suspected of the highest number of gross violations in the election procedures, which is suspected of black bookkeeping and leaders of which are charged with fraudulent bookkeeping," she told reporters.

The third party at the talks, Order and Justice, also has a chequered past. It is led by Rolandas Paksas, a former president who left office after impeachment proceedings and is thus not allowed to participate in the elections personally. He wants the other two parties to go ahead with the coalition regardless. That looks unlikely.

But finding an alternative coalition is tricky. The Conservatives are the second-biggest party with 33 seats. Their erstwhile coalition partners, the Liberal Movement, got 10 seats. That is not enough for an alternative coalition excluding Labour and the Social Democrats. Nor does it make a difference if the Liberals switch sides. Their help does not give the Social Democrats a majority, and in any case the Liberals say they will stick with thier allies, even in opposition. Mr Kubilius urged [link in Lithuanian] "responsible parties" not to get involved in "dirty coalitions".

Another possible coalition partner is the "Polish" party (representing Lithuanian citizens who speak Polish and/or identify with Polish history and culture). For the first time it won enough seats (eight) to form a parliamentary group (a "faction" in Lithuanian political parlance). The Poles don't want to work with Labour, but they could form a coalition with the Social Democrats. But that would not create a majority.

On paper, a grand or "rainbow" coalition of Social Democrats, Conservatives and Liberals would have a majority of 81. But many fear the consequences of the mainstream ceding opposition to the "non-traditional" parties. Mr Kubilius says he does not want to substitute for the Labour party as a junior partner for the Social Democrats.

Complicating matters further is that the Social Democrats are themselves divided. A majority group have their roots in the reformist wing of the old Lithuanian Communist Party (which became ardently pro-independence in the Soviet Union's final years, under its leader the late Algirdas Brazauskas). A minority wing is closer to the values of the old pre-war party and to modern European social democracy.

If all parties barring Labour and the Conservatives join together, the result would be a majority government with 78 seats. But such a coalition hardly seems ideal, especially as it would lead Lithuania during the EU presidency in mid-2013. Although the presidency is much diminished in importance these days, it still offers a small country a chance to improve its profile. A divided, weak or scandalous government would not help in that. Neither would a minority one. Ms Grybauskaitė's huge personal popularity may represent Lithuania's best chance of stability in the coming months.