LONDON — Prime Minister Boris Johnson said on Friday that he had the coronavirus and was suffering mild symptoms, becoming the first leader of a major Western country known to have contracted the virus.
The prime minister, 55, said he would isolate himself in his official residence, 10 Downing Street, but would not relinquish his duties.
On Monday, after resisting harsher measures for more than a week, Mr. Johnson imposed a lockdown on Britain to try to curb the spread of the illness. He continued to meet with advisers and appeared most days at a televised briefing, though not on Thursday.
“I’ve developed mild symptoms of the coronavirus,” Mr. Johnson, looking pale and speaking with a rasp in his voice, said in a video posted on Twitter. “Be in no doubt that I can continue, thanks to the wizardry of modern technology, to communicate with all my top team to lead the national fightback against coronavirus.”
Mr. Johnson said that he was tested on Thursday after he began running a temperature and suffering a persistent cough.
The news came after it was announced this week that Prince Charles, the eldest son of Queen Elizabeth II and the heir to the British throne, had the virus.
Buckingham Palace said that the queen remained healthy and was sequestered at Windsor Castle. Mr. Johnson delivered his weekly briefing to the queen by telephone on Wednesday.
Later on Friday, the British health secretary, Matt Hancock, announced on Twitter that he, too, had tested positive. “Thankfully my symptoms are mild and I’m working from home & self-isolating,” Mr. Hancock posted.
Justin Trudeau, the prime minister of Canada, has also been in self-isolation after his wife contracted the virus, and Chancellor Angela Merkel of Germany has taken similar measures as a precaution.
Ms. Merkel said that she was doing fine and keeping busy while in quarantine, but that it was not without its difficulties. “I miss personally taking part in cabinet meetings and not seeing the people there, or not having any personal contact whatsoever,” she said on Thursday. “So it is different, and I can’t say that I won’t be sorry when this quarantine period reaches an end.”
Mr. Johnson had initially staked out a more relaxed position than other European leaders on the timing and strictness of measures that Britain should take to slow the spread of the virus. He had balked at forcing pubs and restaurants to close their doors and shut down schools, as France and Germany had done.
Last weekend, however, the government shifted its strategy and embraced the more serious measures used on the continent. Mr. Johnson has said that he is guided by scientific advice and has timed the introduction of social distancing measures so they are most effective and accepted by the public.
The prime minister appeared to follow the same advice in his own case. In a statement, the government said, “After experiencing mild symptoms yesterday, the prime minister was tested for coronavirus on the personal advice of England’s chief medical officer, Prof. Chris Whitty.”
“The test was carried out in No. 10 by N.H.S. staff and the result of the test was positive,” the statement said, referring to the National Health Service. “In keeping with the guidance, the prime minister is self-isolating in Downing Street.”
Among the questions the government will face is how many people Mr. Johnson came into contact with over the last few days. Many officials had stopped working in Downing Street, participating in meetings via conference calls. But a skeleton staff continued to work in the residence.
An official at Buckingham Palace said on Friday that Mr. Johnson last met with Queen Elizabeth in person on March 11. The official said that the queen remained healthy and would not comment further.
Mr. Johnson did not appear at the daily news conference on Thursday, at which the chancellor of the Exchequer, Rishi Sunak, outlined the latest plan to protect workers who have lost wages because of the lockdown in the country.