If nothing else, they have each other.

On one of the most difficult days in both of their tenures, President Trump and Prime Minister Boris Johnson of Britain, stars of an emerging trans-Atlantic buddy story, met in New York to talk global affairs only to have to fend off troubles back home.

For Mr. Johnson, it was a devastating unanimous ruling by Britain’s Supreme Court that he violated the law by suspending Parliament amid the roiling debate over how to leave the European Union. Sitting with Mr. Trump at the United Nations on Tuesday, Mr. Johnson was asked by a reporter whether he would resign.

“Let’s be absolutely clear — we respect the judiciary in our country, we respect the court,” Mr. Johnson said. “I disagree profoundly with what they had to say,” he added, but he said he would proceed with plans for withdrawing from the European Union by the end of October. “Frankly, I think we need to get on with Brexit,” he said.

Mr. Trump expressed sympathy. “That was a very nasty question,” he said, noting that it came from an American reporter.