Kate Maltby is a regular broadcaster and columnist in the United Kingdom. She writes a weekly column on politics and culture for The Financial Times and is a theater critic for The Times of London. She was on the founding team behind the reform conservative think tank Bright Blue and is also completing a Ph.D. in renaissance literature. The opinions expressed in this commentary are hers.

Executive Order 13769 is headed to the Supreme Court; the President's lawyers are arguing it does not constitute a "travel ban," so the President immediately undermined his own team by labeling it just that on Twitter. (Deputy press secretary Sarah Huckabee Sanders repeated the phrase "travel ban" at a news conference Monday afternoon.)

Numerous leaks in recent days claim the President is at odds with most of his senior team, allegedly deliberately countermanding their best advice like an obstreperous toddler. And fired FBI Director James Comey is to testify to a congressional committee later this week. Perhaps it was inevitable that Trump would look for a distraction.

His choice of distraction is unfortunate for all of us, British and American. First thing in the morning after Saturday night's killings in London, Trump decided to renew an old fight with Sadiq Khan, the mayor of London.

Khan gets under Trump's skin for the same reason lawyers have been this week: When the President first publicly insulted Khan, earlier this spring, it was in response to his criticism of Executive Order 13769. Back then, Khan was merely the most popular politician in the UK and its most senior elected Muslim.

By the time of Trump's latest verbal assault, Khan had become the figurehead of a city in mourning. Not just any city: the capital of one of the United States' most important allies. Imagine if Theresa May, the UK Prime Minister, had responded to last year's homophobic attack in Orlando, Florida, by launching a sustained attack on the policies of Orlando Mayor Buddy Dyer.

On a very basic level, Trump's tweets are highly distasteful. They also give the appearance of being racist. Two weeks ago, terrorists also struck in Manchester, a British city with a mayor from Khan's Labour Party. Manchester's first responders may have done a less efficient job than London's in the aftermath, though the toll of the attack was greater: Stories circulate about relatives given no information about missing loved ones. But oddly enough, there was no tweet from Trump attacking Manchester's mayor, Andy Burnham. Could it be because Burnham is a white man with Roman Catholic roots?

Or is it simply because Khan has had the temerity to stand up to Trump before -- when he called him "ignorant about Islam" and suggested he was giving terrorists what they wanted? In an interview with Britain's Piers Morgan last May, President Trump growled like a mafia don and said of Khan's criticisms: "Frankly, tell him I will remember those statements, those very nasty statements." If that's what lies behind Monday's Twitter barrage, it is a mark of the cheapest possible statesmanship to prioritize an old feud over diplomatic relations with an allied nation state in mourning.

Trump's gift to Sadiq Khan

If Trump meant to damage Sadiq Khan, he's mistaken. Being marked as an enemy by the former "Apprentice" star is about the surest-fire way to cult popularity in Britain short of personally masterminding a One Direction reunion. By contrast, the people Trump will damage are his supposed conservative allies in Britain. Theresa May, the Prime Minister, is reported to be exasperated.

May comes from the Conservative Party, which she is leading in an election campaign against Sadiq Khan's Labour Party. This should make them opponents, but Khan is not the leader of the Labour Party, and has used the unique position of the London mayoralty to assert his independence from both the federal government and his own party leader, Jeremy Corbyn.

This isn't unusual behavior from mayors and regional governors on both sides of the Atlantic: His job in London allows Khan to play responsible civic leader while being uncontaminated by the mudslinging that goes on in the national Parliament. As mayor, he does not have an official opposition figure to fight with, and he is not up for re-election this cycle.

But May is up for re-election, and she is under huge pressure to disassociate herself from the American President. That is, of course, diplomatically impossible, although UK officials have already taken the step of temporarily severing intelligence-sharing links with the United States, after classified information about the Manchester bombings appeared in the American press.

At a news conference early Monday, when asked about President Trump's comments, the Prime Minister took the unusual step of praising a mayor from another party, telling reporters that Khan was "doing an excellent job as mayor" and stressing that she was fully cooperating with him to jointly oversee anti-terror operations in London. But she stopped short of explicitly condemning Trump's tweets, clearly hoping the matter would go away. How did President Trump reward her? He doubled down on his tweets just three hours later, accusing Khan of a "pathetic excuse" for his failure to prevent terror.

Worst possible time?

This comes at the worst possible time for May. Terror attacks usually result in a spike of support for Conservative parties perceived to prioritize law and order: Saturday's attack, coming only five days ahead of the general election, might still have that effect. But Brits don't like being seen to give in to fear.

Labour leader Corbyn, despite his rocky record of supporting far-left terrorist groups himself, has taken the spike in extremism as an excuse to attack Britain's foreign policy and American alliance. Many are buying it: The easiest way of signaling virtue in post-Tony Blair Britain is still to attack the war in Iraq or the American government.

Follow CNN Opinion Join us on Twitter and Facebook

This has precedent. In Madrid in 2004, Spain experienced the deadliest terror attack in Europe since the 1988 Lockerbie bombing. It was three days before the general elections and completely reversed the political narrative. The Spanish people voted overwhelmingly that week to defeat the government, on the grounds that it had sent Spanish troops into the Iraq War alongside America, which was perceived to have inflamed Islamic feelings.

We won't know for sure how the events of this week have influenced British electoral politics until the votes are counted this Friday morning. But one thing is clear. The unpopular President Trump would be well advised to stay out of it. And every attack he tweets against Sadiq Khan only strengthens the position of the British left. Ironically, that does damage Khan slightly: It delays the collapse of the current Labour leadership -- and thus Khan's longheld plan to take over. But I doubt that's much consolation to Theresa May.