Three days after a top aide to Vice President Pence tested positive for the deadly coronavirus — throwing President Trump and his team into an anxious frenzy — the White House made official for its employees what have long been prescribed for the public at large: masks.

A memo Monday instructed most White House officials to wear masks or face coverings in the West Wing, as well as avoid “unnecessary visits” there — directives to prevent the novel coronavirus from spreading further inside the presidential compound.

The request does not apply to staff members seated at their desks if they are “appropriately socially distanced,” and Trump is not expected to wear a mask in the White House, aides said. In a sign of the haphazard effort to impose more stringent safety standards inside the White House, one senior administration official and several other aides were still arguing that masks were unnecessary for people getting regular testing just moments before the memo was sent.

A Rose Garden news conference Monday aimed at announcing new money for testing provided a striking illustration of the uneven measures, as Trump presided over the event without a mask as everyone around him, from reporters to aides, wore them.

“In the case of me, I’m not close to anybody. . . . Obviously in my case, I’m very far away from everyone. But if you look at all of those people over there,” Trump said, pointing to staffers lined up at the West Wing Colonnade, “every one of them from what I can see, these are White House staffers, they’re White House representatives, they’re White House executives, and everybody has a mask on. Just about everybody I’ve seen today wore a mask.”

Monday’s directive reflected the latest attempt at mitigation by an administration that has struggled to manage the pandemic, including inside the 18-acre confines of the White House compound. Two officials — Trump’s military valet and Pence press secretary Katie Miller — have tested positive for the novel coronavirus so far in a workplace where the recommendations of the administration’s health officials have often been ignored.

Trump has consistently declined to wear a mask and, until Monday, those around him have generally followed his lead. His news conferences before Monday’s were notable, in part, for how little social distancing administration officials exhibited.

Pence, who was exposed to his infected staffer, has declined to fully isolate himself, despite the Centers for Disease Control and Prevention recommendation that people in close contact with someone who has the virus remain at home for 14 days to protect others.

A Pence spokesman said Sunday night that the vice president has continued to test negative and is following the advice of the White House Medical Unit but is not quarantining.

Public health officials say that by flouting the administration’s best practices, White House officials are not just modeling poor behavior for the public but also putting themselves and the president at risk.

“If you’re going to not follow your own agencies’ workplace guidance, and if you’re not even performing necessary precautions — masks, testing, tracing and isolation — it’s a setup for an infectious-disease disaster,” said Kavita Patel, a physician and health policy adviser who worked in the Obama White House.

Patel said she was surprised the White House was being so cavalier, in part because of the national security implications. “I would assume you’d keep the vice president away from the White House as much as possible, not because he has it, but because you don’t want to risk any exposure,” she said. “I’ve been shocked by how frequently the vice president and the president have been together.”

A senior administration official said the vice president and president are expected to maintain some distance for the immediate future and are unlikely to be in the same room. “It can and will be evaluated on an as-needed basis,” the official said.

During Monday’s news conference, Trump said he had not seen Pence in person since his press secretary had become infected. Pence was not in attendance.

Several senior White House officials said it was unlikely he would ever fully quarantine for the recommended two weeks while continuing to test negative, in part because of his role as head of the White House coronavirus task force.

Kellyanne Conway, counselor to the president, said Pence is behaving as safely as possible, while performing the key functions of the job. “The vice president is following medical guidance and taking precautions as is practicable without interrupting the roles and responsibilities of the second most important person in our government,” she said.

Inside the White House, the level of anxiety has oscillated. Trump feels both frustrated and stuck, said one Republican close to the White House: He can’t go out and campaign, coronavirus deaths are climbing, his poll numbers are faltering, and he believes he is not getting sufficient credit for his handling of the pandemic.

Trump is also “a total germaphobe,” one former official said. “He has been concerned that there are people who have been in close quarters and nearby him who are infected. His principal method has been, ‘I’ll make sure everyone around me is tested and then I don’t have to take precautions.’ Now that some of them tested positive, that has real consequences.”

The former official also said the positive tests for Trump’s valet and Miller — both of whom spent significant time inside the cramped warrens of the West Wing — made the virus feel more concrete and tangible for staff, representing a “penetration into the inner parts of the onion.” Katie Miller is married to senior policy adviser Stephen Miller, who has been absent in recent days.

This former official and other current and former aides spoke on the condition of anonymity to discuss internal deliberations.

Staff worries have largely been based on their relative access to Trump. Those who interact with the president regularly are getting tested daily, which has helped reassure them as to their safety. But those who do not regularly see the president, yet work in the West Wing or Eisenhower Executive Office Building, are not tested as frequently and are more anxious about catching or spreading the virus, aides said.

The result has been something of an unspoken caste system among White House staff, one of the former officials said, explaining that even inside the West Wing, there exist “the Haves and the Have Nots,” with less senior officials feeling more vulnerable.

Staffers now have their temperature checked before going to see Trump, and doctors question people about any symptoms before they’re allowed to come through the White House gates. The senior staff meeting has been divided into two rotating groups — one of which calls in and the other attends in person in the Roosevelt Room. Aides have been instructed to try to limit larger meetings and call in when they can.

Yet there has been some internal resistance to stringent measures. Some White House officials believe CDC Director Robert Redfield and Food and Drug Administration Commissioner Stephen Hahn — both of whom are quarantining for 14 days after their exposure to Miller — are overreacting.

Some on Pence’s team had previously worried that having White House staff wear masks was poor optics, and, in an earlier, heated debate between the White House and CDC, argued that only people in virus hot spots should be required to wear masks, people familiar with the discussions said.

Because the president is often swayed by those in closest contact with him, aides and advisers have felt pressure to keep as close to him as possible. Trump campaign manager Brad Parscale has twice flown to Washington from his Florida home, while Republican National Committee Chairwoman Ronna McDaniel has done so once — both for meetings with the president that could have been done via phone, according to one person familiar with the meetings.

On Capitol Hill, meanwhile, staff levels have plummeted during the pandemic. The House has been fully in session only two days since mid-March, and even in those rare sessions, most lawmakers brought in only one aide to work in the congressional office buildings.

Congress’s Office of the Attending Physician issued guidance to the Senate, which returned last week to a somewhat normal session, to leave most aides at home teleworking, and most senators brought in a skeletal number of staff members — all of whom wore masks when they accompanied senators to the Capitol for votes.

Still, Monday seemed to mark at least a psychological turning point for some in the White House. As Pence departed the White House on Monday and his motorcade headed north on 17th Street toward his residence at the U.S. Naval Observatory, a Secret Service agent in one of the armored cars could be seen sporting a mask.

Paul Kane and Carol D. Leonnig contributed to this report.