The Palace of Culture in Tirana has housed Albania’s national library, opera and ballet companies for almost 50 years. Khrushchev laid the first stone, in May 1959, during what one American newsreel described as a ‘lengthy visit with mysterious overtones’. These days the ground floor of the opera is a count centre during national and local elections. At around 10 p.m. on Sunday, 23 June, three hours after polls closed in parliamentary elections, a queue of officials carrying clear plastic ballot boxes snaked up the steps outside the opera. Policemen in wide-brimmed hats formed a porous cordon around the votes. Party loyalists, with pens and notepads to tally the votes as they were counted, hovered on the terrace, waiting for the lobby to open. Counting had been scheduled to start at eight.

One of the tallymen was Erad, a 25-year-old economics graduate. 'I could be here for two days, maybe three,' he said, lighting a cigarette. What mattered was that his party, the recently formed nationalist Aleanca Kuq e Zi (Red and Black Alliance), won enough seats to be kingmaker in the new parliament. ‘I think we will do well. If we get three or four seats I’ll be OK,’ he said.

Horns blared from the cars on Skanderbeg Square. Young men festooned with flags for the ruling Democratic Party leaned out of windows and shouted: ‘Sali Berisha, Sali Berisha!' Berisha, a prominent figure in the Albanian Party of Labour under Hoxha and president of the republic in the mid-1990s, was aiming for a third straight term as prime minister. ‘Corruption is our biggest problem. The system is corruption and corruption is the system,’ Erad said. Transparency International ranks Albania 113 of 176 countries in its corruption perceptions index.

Counting started at 4 a.m. on Monday. Later that morning I returned to the opera. Screens relayed scans of every ballot to around fifty tallymen and women. They looked like punters at a greyhound track. I found Erad leaning against the wall at the far end of the room . ‘How's it going?’ I asked. 'Keq,' he said. Bad. His page was almost blank. He looked exhausted. I asked why he didn't sit down. ‘I am more vigilant if I stand up.’

The opposition Socialist Party disputed the results of the previous general election, in 2009, boycotting parliament for 18 months and claiming Berisha had stolen the vote. In January 2011, four protesters were shot dead in Tirana. Later that year, in the capital’s mayoral elections, the Socialist incumbent, Edi Rama, lost by 81 votes. He had been declared the winner, but it was then decided that ballots that had been placed in the wrong boxes could be included in the final total. Ahead of this year’s election, one Albanian activist told me he expected the result in ‘a week or two, maybe more’.

Polling day had begun inauspiciously. In the north, an opposition activist was shot dead and a ruling party candidate seriously injured in a gunfight outside a polling station; a TV crew were attacked, their equipment destroyed. But the rest of the day passed in relative peace, and, despite numerous reports of vote buying, especially in crucial marginal constituencies, the OSCE declared the vote ‘quite fair’. By Monday afternoon it was apparent that Rama was on course for a crushing victory.

I paid a final visit to the opera that evening. A fug of smoke hung heavy in the lobby; there were men sleeping on the floor, surrounded by discarded pizza boxes and empty Red Bull cans; someone was running his fingers over the piano. I found Erad where I had left him, still tallying the Red and Black Alliance’s invisible votes. The previous night he had been exuberant – offering to get me ‘whatever I wanted, girls, drugs, guns’ – now he was silent. His friend was also counting for the Kuq e Zi. I asked if I could see his notebook. The thin dashes in the Socialist column outnumbered those for the Democrats by almost two to one. I asked Erad if he would leave Albania. ‘That is a hard question... In 1991, everyone just left. They went anywhere. But things are different now.’

Albanian politics certainly looks different. On 26 June, Berisha publicly conceded defeat, taking full responsibility for his loss. Rama will be the next prime minister: his coalition won 84 seats out of 140. There was no violence, only more cars, this time decked out in Socialist purple, circling Skanderbeg Square. The Red and Black Alliance, like most of the 60-plus parties that contested the election, won no seats. The European Commission is expected to recommend EU candidate status before the end of the year.

Arguably the biggest winners were not the Socialists, who gained only one seat, but their junior coalition partners, the Movement for Socialist Integration (LSI). Until April, when they joined forces with the Socialists, the LSI were in government with the Democrats. The fatal demonstrations in 2011 were sparked by a video of the LSI leader (and former Socialist prime minister), Ilir Meta, appearing to discuss accepting a bribe. His career looked as if it might be over. But he was acquitted of corruption, and now leads a party whose representation has jump from 4 to 16 seats.

As the count closed at the opera in Tirana, I fell into conversation with Besar, a young man tallying for the LSI. He told me that he supported Meta’s party ‘because they support me’. As we talked, a hard-faced man came over and tugged on Besar’s shoulder. ‘He told me to watch closely,' Besar told me when the man had gone. 'To stay focused. Not to miss any chances.’