THE next prime minister of Albania will be Edi Rama, leader of the Socialist Party. With almost all the votes counted after voting took place on June 23rd, his coalition looks likely to take 84 out of 140 seats in parliament—a landslide. The result ends eight years of rule by Sali Berisha’s centre-right Democratic Party, but Mr Berisha has been around much longer than that. No Albanian under 30 can remember a time when he was not a dominant political presence.

Mr Rama is a former mayor of the capital, Tirana. In the 2009 election he accused the Democrats of cheating him of victory. In 2011 he claimed to have won a new term as mayor, but the Democrats snatched victory from the jaws of defeat by adding in votes cast in the wrong boxes. A protest in January of the same year led to four Socialist supporters being shot dead by security forces firing from the prime minister’s office. Mr Berisha accused Mr Rama of trying to oust him by force.

In the past few years under Mr Berisha, spanking new roads and other infrastructure have sprouted across Albania. Cyclists zoom down bicycle lanes in central Tirana and along new roads in previously ramshackle towns like Shkoder, in the north. After the end of communism, Albania’s highways gradually disintegrated. When he was mayor Mr Rama also transformed Tirana, bulldozing many ugly and illegal buildings and painting dowdy communist blocks in bright colours.

Yet improved infrastructure could not save Mr Berisha. Besides the fatigue after eight years, a string of scandals undid him. Few bigwigs ever came to trial. One who did was Ilir Meta, leader of a small breakaway group from the Socialists that allied with Mr Berisha in 2009, enabling him to form a government. A tape was broadcast in which Mr Meta appeared to discuss a bribe and boast of his influence over the chief justice. He was tried and acquitted. In April he abandoned Mr Berisha to form a new alliance with Mr Rama, shocking many Socialists who feared it would hobble attacks on the government for corruption.

For Mr Rama the task ahead is “enormous” because, he says, the system he is inheriting is so rotten. It is packed with placemen of Mr Berisha who, according to Piro Misha, a local analyst, had “total control” of the public administration and judiciary. The pursuit of party interests by using the clout of the state had, says Mr Misha, “gone to an extreme this time”.

The election opens the way for Albania to become an official candidate to join the European Union. Previous applications had been rejected. Yet growth and employment are still big challenges, even if less than in some neighbouring countries. The electoral roll has 3.3m names, but the 2011 census found only 2.8m people in Albania. The difference is that as many as a million Albanians live abroad, sending money home and helping to keep down unemployment—which, despite this, still stands at 12.8%. In recent years remittances have declined, but Albania remains the only Balkan country not to have gone into recession. That did not save Mr Berisha, either.