From the air, it looked as though the war had returned to the battered city of Sarajevo. Blazing fires and the din of explosives suggested a rewind to the dark days of the remorseless Serbian siege of the city 20 years ago.

But unlike then, the streets were thronged with tens of thousands of partying Bosnians. The noise was not from Serbian artillery pieces but from fireworks. Because Bosnia's footballers are going to Brazil.

It will go down as probably the most joyful moment in the chronically divided country of Bosnia-Herzegovina in almost two decades, as qualification for next year's World Cup triggered ecstatic all-night celebrations on the streets of the capital and other cities.

For a day or two at least, the ethnic frictions and political dysfunction dissolved in an outpouring of pride. Adnan Hadzic, on the streets until the small hours, said it was the happiest night of his life. "I have never felt like this. It's magical … there are no words. After all the mess we see every day, we need this happiness," he said.

The team returned to Sarajevo at 3am after a 1-0 victory in Lithuania, and received a heroes' welcome from tens of thousands on the streets. When the final whistle had blown in Vilnius hours earlier, commentators on Bosnian TV screamed themselves hoarse: "We're in Brazil, We're in Brazil, B-H is in Brazil!"

Pundits were quick to proclaim the victory the best news for a depressed society in a long time. Politicians – a highly discredited class in Bosnia – suspended their bickering and leapt on the football bandwagon. Many pointed to the contrast between the demonstration of ethnic togetherness on the field and the nationalist gridlock that hamstrings governance.

"The national team has shown us all how to achieve results, not just in sports but in any field," said Denis Becirevic, speaker of the parliament in Sarajevo. "We can be successful if we work together. I hope this win will spark positive changes in our country."

Zlatko Lagmudzija, the foreign minister, said the players were "the best role models for future generations in Bosnia and Herzegovina".

Celebrations in Sarajevo. Photograph: Amel Emric/AP

The achievement was all the more remarkable for the failure of several Balkan rivals yet to book their place in the finals. The Greeks, who were in Bosnia's group, and the neighbouring Croats face playoffs next month.

The cheering was distinctly quieter in Bosnian Serb areas, where there is more support for the Serbian team which failed to qualify. But Emil Vlajki, vice-president of the Bosnian Serb half of the country, said Bosnia's football team was a national success story. "It does not matter what result we achieve at the actual World Cup, they are already among the world elite. All I have to say is bravo, bravo, bravo," he said.

Goran Obradovic, a Serb journalist in the main Bosnian Serb city of Banja Luka, said he and most of his friends cheered the Bosnian team, and the bars were filled with young people watching the game. "After the win there were no celebrations to speak of, but compared to the past we can see a trend of more and more Serb cheering on the Bosnian national team."

Aleksandra Letic, a human rights activist in Banja Luka, pooh-poohed the healing power of football, however. "Unfortunately the divisions are so big, sports or culture alone cannot overcome them. Cheering Bosnia now is not a sports thing, it is a political issue, an issue of national and ethnic identity," she said.

"I am not surprised by the wild celebrations in some parts of the country. We have so little good news, so people celebrate what they can. However, one part of the country ignored these celebrations – the Republika Srpska [Serbian] entity."

The sour note was amplified in Brussels where the European commission delivered its annual verdict on the country's progress towards being able to open talks to join the EU, dumping Bosnia firmly at the back of the Balkan queue.

"Bosnia has made very limited progress in addressing the political criteria. A shared vision by the political representatives on the overall direction and future of the country, or on how it should function, remains absent," the commission said. "No progress has been achieved either on establishing an effective co-ordination mechanism on EU-related matters between various levels of government. Such a co-ordination mechanism is essential."

But the grim verdict from Brussels will not impinge on the boost to Bosnian self-esteem. Following a night of riotous celebrations in the central town of Travnik, Samir Perenda, a Bosnian Muslim, said: "It was just wild happiness and a surreal feeling … I still think I'm dreaming."