Five “urban explorers” who climbed a Canary Wharf skyscraper have avoided jail for defying a court order banning them from trespassing on the site.

The five teenagers climbed to the top of the 58-storey Newfoundland building, which was under construction, on September 22.

One of the group posted a picture of himself at the top of the building on social media the next day with the caption “What court injunction?”, the High Court heard.

At a hearing on Monday, Alexander Farrell, 19, Usama Quraishi, Elliot Hensford and Finley Gleeson, all 18, and a 17-year-old who cannot be named for legal reasons, all admitted trespassing on the Canary Wharf estate in breach of a High Court injunction.

Judge Jeremy Freedman said he would not jail them for contempt of court “as an act of leniency to safeguard your futures”, but warned them: “You must never, ever engage in this activity again.”

The Canary Wharf Group, which owns the nearly 100-acre Canary Wharf estate, obtained the injunction against named individuals, including Mr Farrell, and “persons unknown” in February to prevent trespass on the estate.

David Forsdick QC, representing the Canary Wharf Group, said his clients are “the owners of a major estate whose security is of national significance and which is the subject of major security measures for national security reasons”.

He added: “It has iconic ‘trophy’ buildings which the urban explorer community have repeatedly sought to, and in fact have, climbed. There have been multiple banning notices over a prolonged period which have been repeatedly ignored.”

The barrister said that, following the death of a young man on January 2 this year, “my clients felt they had no option but to seek a wide-ranging injunction”.

He said “it was not just because they were precious about their buildings”, but their concern was “about the security of the financial system of the United Kingdom”.

Mr Forsdick added that diverting security staff from “their principal function, which is anti-terrorism” was “about as serious as it gets”.

He said all five “clearly knew of the terms of the order and were warned repeatedly as to the consequences of it, including on the door where they broke in”, which he said “spelt out that you are liable to be sent to prison”.

Mr Forsdick added Mr Farrell - who is also subject to similar injunctions preventing trespass at Chelsea, Manchester City and Manchester United’s football stadiums - should be treated “slightly differently”, as he was named in the original injunction and had given an undertaking not to trespass on the Canary Wharf estate.

The judge said he was satisfied that “each of the five respondents were well aware of the existence of that order”, but nonetheless “broke through a secure door and entered a building under construction”.

He added: “That they had trespassed on this building became clear from their posts on social media.”

Judge Freedman observed that “the activities of urban explorers cause considerable harm and could result in very serious danger”, and said “any of them could have died on the night in question”.

He added: “If people like the respondents break into buildings for their own gratification, that has the potential to compromise matters of national security.”

Addressing the five, Judge Freedman said he found it “hard to believe” that they did not appreciate the seriousness of the injunction.

But he said: “Nevertheless, I am satisfied that it is only now you have been brought to the High Court and realise the gravity of your position that you fully realise the implications of your actions.”

He told the five that having “the good sense to admit your involvement” was their “saving grace”, and warned them that they faced an immediate custodial sentence “if any of you breach any further order in any way”.

The judge imposed a £250 fine on Mr Farrell, who, he said, had “flagrantly” breached an undertaking not to trespass. He did not impose any penalty on the other four, who, he said, had been through “the indignity of coming to court to face these allegations of contempt”.

Speaking outside court, one of the group said: “If it’s this easy for a bunch of kids to get in, also terrorists will get in easily. We’ve actually helped them out.”

He added: “We’re just not going to breach any more injunctions.”