AirAsia boss Tony Fernandes on Sunday apologised for a controversial stunt endorsing scandal-tainted prime minister at the time Najib Razak before Malaysia’s general election, in which he suffered a stunning defeat.

Fernandes said he came under pressure from Najib’s government before the May 9 vote, causing him to issue a video enthusiastically crediting its policies for the success of the home-grown low-cost carrier.

But the Barisan Nasional coalition, which had ruled Malaysia for 61 years, suffered a humiliating defeat on Wednesday at the hands of an opposition alliance led by his former mentor and ex-prime minister Mahathir Mohamad, 92.

Fernandes was strongly criticised online for the stunt endorsing Najib, who has been linked to a multibillion-dollar corruption scandal involving Malaysian state fund 1MDB.

A photo showing Fernandes with Najib on board an AirAsia plane was widely circulated during the election campaign. That plane was painted in the blue colours of Najib’s Barisan Nasional coalition.

Fernandes even changed the uniforms of AirAsia flight attendants from red to blue during that trip.

But in a video posted on his Facebook page on Sunday, a sombre-looking Fernandes apologised for his “grave error of judgment”.

“I’m sorry for what has gone on. I buckled at a crucial moment in our history,” he said.

Fernandes said he had been under “tremendous” pressure from the former government to sack popular former trade minister Rafidah Aziz, who is on the board of AirAsia’s long-haul budget arm AirAsia X, because she was campaigning for the opposition.

“Under the intense pressure, I buckled. It wasn’t right, I’ll forever regret it but it was a decision made at the spur of the moment,” he said. “I apologise again for the pain and the hurt I caused.”

The new government slapped Najib with a travel ban on Saturday as speculation mounted he was about to flee the country in a possible bid to avoid prosecution over the 1MDB scandal. He has denied any wrongdoing.