Three women and the gunman who took them hostage were found dead Friday evening at a home for military veterans in Northern California, hours after the gunman had fired at a deputy, the authorities said.

Assistant Chief Chris Childs of the California Highway Patrol said the four people were found shortly before 6 p.m. local time inside a room at the Veterans Home of California in Yountville, where the hostages had been taken.

“This is a tragic piece of news — one that we were really hoping we wouldn’t have to come before the public to give,” Chief Childs said at a brief news conference.

In a statement, the Napa County authorities identified the gunman as Albert Wong, 36, from Sacramento. The Associated Press, citing Defense Department records, said Mr. Wong was an Army veteran who had served in Afghanistan, and the Napa County statement said he had been associated with the Yountville facility’s Pathway Home treatment program.