A UPS employee opened fire in a San Francisco package delivery facility in a shooting spree that left four dead, including the gunman, on Wednesday, police and the company said.

The gunman barged into the facility near 17th and Vermont streets around 9 a.m. local time and began shooting, San Francisco police confirmed to Fox News. The building is located in the Potrero Hill, which is about 2 1/2 miles from downtown San Francisco.

Two other people remain hospitalized. The gunman died of a self-inflicted wound, police said.

Family members identified one of the victims as 46-year-old Mike Lefiti, who worked as a UPS driver. The two other victims fatally shot by the gunman have not yet been identified.

Police identified San Francisco resident Jimmy Lam as the shooter, according to NBC Bay Area. Lam has a history of mental illness, sources said. He was dressed in a UPS uniform at the time of the shooting, police said. UPS spokesman Steve Gaut confirmed the gunman was an employee at the facility.

The motive of the shooting is still unclear, police said, adding that they believe the incident was not terror-related. The FBI was aware of the shooting but did not intervene, the bureau told Fox News.

The shooting led to a massive police response, initiating a shelter-in-place for the surrounding area. The warning was lifted nearly three hours later after the incident was "contained" and the building was "secured," police said.

A woman who said she was an employee at the facility told KTVU that the gunman opened fire on the main sorting floor.

Auto shop owner Robert Kim said he heard about five to eight rapid gunshots. Just moments later, "there's a mob of UPS drivers" running down the street screaming "shooter, shooter," Kim said. Another witness said a group of about 10 workers assembled on the roof and held their hands up as police began to arrive.

A UPS spokesman said in an earlier statement to Fox News that there was an "incident involving employees" at the facility.

"Local law enforcement have control of the facility and are conducting an investigation. The company is cooperating with law enforcement. We cannot provide information as to the identity of persons involved at this time, pending the police investigation," the statement read.

"The company is saddened and deeply concerned about affected employees, family members and the community we share."

San Francisco Mayor Ed Lee offered his condolences and said he was "always saddened by the loss of life to gun violence."

Fox News' Jake Gibson and The Associated Press contributed to this report.

Click here for more from KTVU.