WASHINGTON — Congress is shutting the Capitol to the public until April in reaction to the spread of the coronavirus, officials announced Thursday, a rare step that underscores the growing gravity with which the government is reacting to the viral outbreak.

In a statement, the House and Senate sergeants at arms said congressional office buildings and the Congressional Visitor Center, through which tourists enter the Capitol, were also being shuttered.

In an email to lawmakers' offices, the sergeants at arms said the Capitol will be closed to all tours, including special ones led by House and Senate members and their aides. No tours will be permitted in the Capitol Visitor Center, the massive three-level underground structure, which opened in 2008 and had greeted more than 21 million visitors through 2018.

Lawmakers’ offices will be required to meet any official visitors at building entrances, and they were asked to escort them out after the meetings.

Only lawmakers, staff, journalists and visitors with official business will be permitted to enter the buildings. The closures begin at 5 p.m. EDT Thursday, and the buildings are scheduled to reopen on April 1.

The officials said they were acting on the advice of District of Columbia health officials and of Congress' own doctors.

“We are taking this temporary action out of concern for the health and safety of congressional employees as well as the public," they wrote. “We appreciate the understanding of those with planned visits interrupted by this necessary but prudent decision.”

Congress is scheduled to be on recess next week.

President Donald Trump's administration and Congress have struggled over how to react to the virus and COVID-19, the disease it can cause that in some cases can be deadly. Congressional leaders have had to balance conflicting desires of protecting lawmakers and staffs from getting sick with keeping one of the country's most visible public buildings open. At the White House, tours have been temporarily suspended.

In the fall of 1918, the Capitol was closed briefly to visitors as the Spanish flu spread around the world, killing an estimated tens of millions of people. Around 1,000 people died in the Washington, D.C., region along with at least three members of the House, according to the chamber's historians' office.

For most people, the new coronavirus causes only mild or moderate symptoms, such as fever and cough. For some, especially older adults and people with existing health problems, it can cause more severe illness, including pneumonia. The vast majority of people recover from the new virus.

According to the World Health Organization, people with mild illness recover in about two weeks, while those with more severe illness may take three to six weeks to recover.

In mainland China, where the virus first exploded, more than 80,000 people have been diagnosed and more than 62,000 have recovered.