WASHINGTON — Ordering firm restrictions for U.S. troops returning from West Africa, Defense Secretary Chuck Hagel said Wednesday that the military men and women helping fight Ebola must undergo 21-day quarantines — longer than required for many civilian health care workers.

In Maine, meanwhile, a civilian nurse was vigorously resisting the quarantine she was told to undergo. Kaci Hickox, who had treated Ebola patients in West Africa, said she planned to stop quarantining herself in her home, signaling a potential showdown on Thursday with state police monitoring her movements and Maine officials preparing to legally enforce the order.

President Barack Obama, meeting with health care workers at the White House, acknowledged that the United States was not invulnerable to the disease but cautioned against discouraging civilian volunteers with overly restrictive measures upon their return home. “We can’t hermetically seal ourselves off,” he declared.

There seemed to be good news from the region of most severe outbreaks. The World Health Organization said the rate of new Ebola infections in Liberia appeared to be declining, although it cautioned that the epidemic there was far from over.

Nearly 5,000 people have died and more than 13,700 have been sickened in the outbreak, which has hit Liberia, Guinea and Sierra Leone hardest. More than 6,300 of those are in Liberia alone. The U.S. military has nearly 1,000 troops in Liberia and just over 100 in Senegal supporting efforts to combat the virus. The total could grow to 3,900 under current plans, although none are intended to be in contact with Ebola patients.

Announcing his decision in Washington, Hagel said, “This is also a policy that was discussed in great detail by the communities, by the families of our military men and women, and they very much wanted a safety valve on this.”

The action goes beyond precautions recommended by the Obama administration for civilians, although Obama has made clear he feels the military’s situation is different.

After meeting with his Ebola advisory team and with health care workers who have been to West Africa or are preparing to go there, Obama cautioned against discouraging health care workers with restrictive measures that confine them upon their return.

“Like our military men and women deploying to West Africa, they do this for no other reason than their own sense of duty, their sense of purpose, their sense of serving a cause greater than themselves,” he said.

“And we need to call them what they are, which is American heroes. They deserve our gratitude, and they deserve to be treated with dignity and with respect.”

Homecoming treatment was a big issue in Maine. Nurse Kaci Hickox told NBC’s “Today” show and ABC’s “Good Morning America” that she was abiding by the state’s voluntary quarantine by having no contact with people Tuesday and Wednesday but would defy the state if the policy wasn’t changed by Thursday.

Her lawyer told The Associated Press that Hickox, who’s shown no symptoms of Ebola, isn’t willing to cooperate further unless the state lifts “all or most of the restrictions.” The governor said Wednesday he was seeking legal authority to keep her in isolation.

Hagel’s restrictive policy for U.S. troops was a response to a recommendation sent to him Tuesday by Army Gen. Martin Dempsey, chairman of the Joint Chiefs of Staff, on behalf of the heads of each of the military services.

In his memo to Hagel, Dempsey said the military chiefs felt compelled to take greater precautions in light of “recent uncertainty surrounding domestic Ebola cases.” He cited growing concern among military families and their neighbors.

“As we order our young men and women forward to execute this important mission, we owe it to them, their families, and their communities to take these prudent measures to ensure that should a member return with Ebola, we will prevent further transmission of the virus,” Dempsey wrote.

Pentagon officials said it was too early to know exactly how the quarantine will work. Hagel said he directed the Joint Chiefs to work that out within 15 days. A Pentagon spokesman, Col. Steve Warren, said it is yet to be determined whether the new policy applies to Defense Department civilians returning from Liberia and to military air crews who fly in and out of the area without staying overnight.

U.S. troops are performing a range of tasks in Liberia to support the battle against Ebola, but none are treating patients or otherwise having direct contact with infected people. For example they have set up a 25-bed hospital to be operated by U.S. Public Health Service medical workers, and personnel from the U.S. Naval Medical Research Center are operating three mobile medical laboratories in Liberia to test blood sample for the virus. U.S. air crews are flying MV-22 Ospreys and other aircraft in the area to deliver supplies, materials and U.S. personnel.

As originally envisioned, Pentagon policy called for troops returning to their home bases from Ebola response missions to undergo temperature checks twice a day for 21 days to ensure they were free of symptoms and to refrain from traveling widely during that period. But they were not to be quarantined and kept from contact with others.

The Army, however, acting on its own this week, put a small number of returning soldiers, including a two-star general, in 21-day quarantine in Italy. That group was the first to return from West Africa after Ebola duty. Warren said that group of soldiers has grown from 12 to 42; all are in supervised isolation at a military base in Vicenza, their home base.

In Liberia, meanwhile, the WHO said there are empty beds in some treatment centers and the number of burials has declined.