Celtic have been left to embrace an outrageous stroke of fortune after Uefa’s decision to reinstate them into the Champions League at the expense of Legia Warsaw, who had beaten them 6-1 on aggregate in the competition’s third qualifying round.

The governing body expelled Legia on Friday morning after an investigation found that they were guilty of fielding an ineligible player in the second leg of the tie at Murrayfield on Wednesday night – as an 86th-minute substitute.

Celtic, rather than Legia, entered the Champions League play-off draw in Nyon and they have been paired with Maribor of Slovenia in the final round before the lucrative group phase. Arsenal have drawn the Turkish club Besiktas as they contest the play-off for the seventh time in nine seasons – they have yet to lose – but it was Celtic’s reprieve that was the stunning detail.

The Scottish champions had been on their knees after losing 2-0 in the home leg against Legia to suffer the heavy aggregate defeat; the tie did not take place at Celtic Park because of the Commonwealth Games. However, matters have since unravelled for the Polish champions.

Legia thought that Bartosz Bereszynski, who had been sent off in their final Europa League tie of last season against Apollon to incur a three-match ban, had served his punishment by sitting out both legs of the club’s Champions League second round qualifying win over St Patrick’s and the 4-1 first-leg victory over Celtic.

However, it emerged that because of an administrative oversight by Legia the right-back had not been registered in the squad for the ties against St Patrick’s, meaning they did not count towards his suspension and he was still technically banned.

Bereszynski’s late and apparently innocuous introduction consequently proved catastrophic, with Uefa applying their regulations to declare that Legia had to forfeit the second leg by a 3-0 scoreline. That made it 4-4 on aggregate and allowed Celtic to wriggle through on the away goals rule. “We made a mistake and we apologise but the punishment is not proportionate,” Dariusz Mioduski, the Legia co-owner, said. “Sport has lost behind closed doors.” The club’s president, Boguslaw Lesnodorski, added, in a message to supporters: “I let you down.”

The manager, Henning Berg, said he was “absolutely shocked” and he talked of the death of a dream. “It’s just a little, small technical mistake in the administration but the consequences are unbelievable,” Berg said. “We acted in good faith and this goes against every intention of fair play and fair competition. To take away the dream of these players is devastating.”

Legia had missed two penalties in the first leg – if either had gone in, they might still have advanced – and, in financial terms, the damage is extreme. Qualification to the Champions League group stage would have amounted to half of the club’s annual budget. They have dropped into the Europa League, where they face a play-off against Aktobe of Kazakhstan. The final of the competition is in Warsaw and the winner will earn entry into next season’s Champions League.

Bereszynski had been tipped to leave Legia, in the light of interest from Benfica, and there is a further twist in that he joined the club from their hated rivals, Lech Poznan, last year. Lech fans are laughing hard at the moment. Uefa announced that they had suspended Bereszynski for one additional European game.

Legia have the right to appeal and they intend to exercise it, having requested Uefa’s full, written reasons for the judgment, but it feels as though it will be little more than a defiant gesture, with Uefa’s regulations – and Legia’s transgression, however unfortunate – looking clear. Any appeal would most likely have to be resolved by 19 August, the date when the Champions League play-offs begin.

It is the second time in four seasons Celtic have benefited from an ineligibility ruling. They were reinstated into the Europa League in 2011-12, despite a qualifying defeat by Sion, after the Swiss club were adjudged to have fielded five ineligible players.

Ronny Deila, the Celtic manager, who had described the match result against Legia as a “black day” for his club, said the reinstatement felt “very strange.” He added: “I feel very sorry for Legia and my friends from Norway there but this is what Uefa said. I have to go with it and now we are preparing for Maribor.”

Arsenal will play the first leg of their play-off against Besiktas at Istanbul’s Ataturk Olympic Stadium on Tuesday 19 August, with the return in London on the following Wednesday. Besiktas, who finished third in the Turkish league last season, are managed by Slaven Bilic and he has Demba Ba, the summer signing from Chelsea, as his centre-forward. The lineup also features the former Arsenal youth player, Oguzhan Ozyakup.