An American court has sentenced a UK citizen to 40 years in jail for plotting a “horrific” bombing at London’s Heathrow Airport.

Vietnamese-born Minh Quang Pham, 33, received the sentence Friday, after admitting three counts of terrorist-related activity based on his support for the group al-Qaeda in the Arabian Peninsula (AQAP).

Prosecutors said the AQAP had directed Pham to detonate a bomb in Heathrow’s arrivals, though he denied that he had ever intended to carry out his plot.

Pham was first arrested in the UK in June 2012 at the request of US authorities and was extradited to the US in early 2015.

In January, he pleaded guilty to one count of providing material support to the AQAP, one count of conspiring to receive military training from the group and one count of possessing and using a machine gun in furtherance of crimes of violence.

During a hearing in the Manhattan court, Pham called his plan a “terrible mistake” that he regretted.

District Judge Alison Nathan, however, said she believed he deserved an “exceptionally severe sentence” after becoming a trusted asset for the terrorist group, who sought to carry out “a horrific suicide bombing” at Heathrow.

According to prosecutors, the defendant secretly traveled to Yemen in 2011 and swore allegiance to the al-Qaeda affiliate there while helping the group with its online propaganda publication.

Pham is said to have been trained by Anwar al-Awlaki, an American-born extremist who was later killed in a US drone strike.

Awlaki allegedly taught Pham how to make an explosive device from household chemicals and detonate it at Heathrow Airport in London, targeting arrivals from the US or the UK.

The AQAP has claimed responsibility for several attacks over the recent years, including the January 2015 attack at the offices of Charlie Hebdo magazine in the French capital Paris, which killed 12 people.

While the bulk of the activities that led to Pham’s arrest and charges occurred outside the US, American prosecutors have broad authority under federal law to try foreigners on US soil who are accused of terrorism-related crimes.