What does it take to get sacked by Theresa May these days? That’s a question being asked on the other side of the Atlantic after the bumbling transport secretary, Chris Grayling, went global and became the subject of an editorial in the New York Times. Under the headline “How does he survive? The curious case of ‘Failing Grayling’”, the paper describes him as “a byword for haplessness in a golden age of political blundering in Britain”.

While the NYT has developed a reputation of late for gloomy coverage of UK politics, Grayling’s political survival is also the subject of increasing astonishment in the UK. The Labour party claims that, as a government minister, Grayling has cost the taxpayer a total of £2.7bn by way of political gaffes. Meanwhile, there are plenty of Conservative MPs who have grown impatient with their colleague over continuing train problems that have got their constituents seeing red. Most recently, Grayling made the news for a ferry fiasco, when he awarded a no-deal ferry contract to a company with no ferries and then had to pay out £33m to Eurotunnel over the decision.

Despite all this, Downing Street insists the prime minister maintains full confidence in Grayling. So how has he managed to defy the laws of political gravity – going from one gaffe to the next with no ticking off?

The truth is that for all of Grayling’s failings, he has one very important special talent: working out how to make himself unsackable. Although he may at times appear inept and out of his depth, he is in some respects one of Westminster’s canniest operators. How else can you explain the fact that, despite all the negative press, he has been a government minister since 2010?

Throughout his ministerial career, Grayling has proved himself a political creature – surviving situations in which it seemed the odds were against him. Despite all the recent bad press, he remains on favourable terms with No 10 – May even wanted to promote him to party chairman in her reshuffle last year. Viewed as one of the more loyal ministers, Grayling is regularly sent on to the airwaves on bad-news days to deliver the party line. He is seen as a lot less bother than ministers such as Amber Rudd or Penny Mordaunt, who can go off script on Brexit. That he is an MP who campaigned to leave the EU also makes him invaluable to May – given that a string of Brexiteers have quit her cabinet in the last year.

Working out how to use his politics to his advantage is something Grayling has been doing for the bulk of his ministerial career. In 2015, there was an expectation that he was on the way out after an uninspiring stint as justice secretary, during which he made a botched attempt at probation reform (which still has implications today) and came under fire for trying to ban people from sending books to prisoners.

David Cameron moved him to leader of the House – a position regarded as the stop before the exit. However, Grayling then threw a spanner in the works by becoming the first cabinet minister to say he wanted to back leave in the EU referendum – and called for collective responsibility to be suspended in the runup to the vote. At that point, it became near impossible for Cameron to sack him without it looking like a Brexit-motivated move.

Grayling managed to do it again in the wake of the referendum. After Cameron resigned and a leadership contest got under way, Grayling quickly hitched his wagon to May, who needed a Brexiteer backer to win support from across the party. This made him far more valuable than if he had tried to join the Boris Johnson and Michael Gove ticket, where Brexiteers were two a penny. He went on to become May’s leadership campaign manager.

It was little wonder, then, that he was awarded a plum job as transport secretary after May became prime minister. Since then, it’s hardly been plain sailing – with Grayling becoming slang for failure and only narrowly surviving a no-confidence vote in the Commons last summer after timetable chaos led to the cancellation of numerous trains. But even now, when Grayling is being widely condemned, a chunk of Brexiteer MPs have gone out publicly to defend their man over the ferry fiasco – instead blaming Philip Hammond for his slow release of funds.

As long as May remains prime minister, Grayling looks safe in his role. And if history tells us anything, there’s every chance he will find a way to make himself indispensable to May’s successor. Chris Grayling may be called Failing Grayling on both sides of the pond, but he has managed to find a level of job security of which the bulk of his ambitious colleagues can only dream.

• Katy Balls is the Spectator’s deputy political editor