By Agence France-Presse
The assailant struck at 10:20 am (1820 GMT) at the Veterans Home of California-Yountville in the Napa Valley, the largest veterans' home in the United States with around 1,000 former servicemen and women.
"Shortly before 6:00 pm this evening law enforcement personnel made entry into the room where we felt the hostages were being held by the suspect and unfortunately made the discovery of three deceased females and one deceased male suspect," Captain Chris Childs of the California Highway Patrol told a news conference.
"This is a tragic piece of news, one we were really hoping we wouldn't have to come before the public to give."
The Napa County Sheriff's Office had earlier issued an advisory on social media telling people to avoid the area following reports of gunfire, as the California Highway Patrol dispatched officers, air support and a SWAT team to the site.
Childs said a sheriff's deputy who was first on the scene exchanged fire with the suspect, adding that "we credit him with saving the lives of others in the area by eliminating the ability for the suspect to go out and find further victims."
The three victims were described by local media as employees of The Pathway Home, an on-site counseling service for veterans who suffer from post-traumatic stress disorder (PTSD).
It is was not immediately clear whether they had been targeted or were chosen at random.
The San Francisco Chronicle said the gunman -- apparently a 36-year-old war veteran wearing "a stash of bullets" around his neck and waist -- had been on the PTSD treatment program, adding that his weapon was a rifle.
- Gunman was calm -
It quoted state senator Bill Dodd identifying the program's executive director, Christine Loeber, as being one of the dead, although the victims' names have not been officially released.
Police did not say how they died, although local media, citing unnamed sources, reported that the assailant shot the three women before turning the gun on himself.
Dodd, whose district includes the center, said the gunman had been asked to leave several days earlier, according to the Chronicle.
"It's a residential program so guys live in the building, staff work in the building," Larry Kamer, whose wife Devereaux Smith was working at the center, told the local ABC7 News channel.
Smith, a development director for The Pathway Home, was one of four women released by the gunman, said Kamer.
"There was a going away party for a couple of the staff who were leaving today. They were having cake and toasting and all that and then he apparently just walked in with this rifle."
Kamer said the gunman was calm and talked to everyone present.
The discovery came after several fruitless hours of trying to contact the man by the sheriff's department, City of Napa Police and the FBI.
California Department of Veterans Affairs secretary Vito Imbasciani said in a statement the agency was "devastated" by the deaths.
"Our hearts are heavy for the entire Yountville Veterans Home community and the families and friends who are grieving for those who died," he added.
"Nothing matters more than caring for our veterans and employees during this difficult time. We appreciate the tremendous law enforcement response today and unfailing support of this community."