Seven people were killed in two related shootings at a mushroom farm and a trucking firm in a coastal community south of San Francisco on Monday, officials said.

San Mateo County Board of Supervisors President Dave Pine says four people were killed at the farm and three at the trucking business on the outskirts of Half Moon Bay, a city about 30 miles south of San Francisco.

It was not immediately clear how the locations were connected.

The San Mateo County Sheriff said on Twitter: "The Sheriff's Office is responding to a shooting incident with multiple victims in the area of (Highway) 92 and the (Half Moon Bay) City limits.

"Suspect is in custody. There is no ongoing threat to the community at this time," it added a short time later.

The shootings incidents come less than 48 hours after a gunman killed 11 people at a dance studio near Los Angeles.

The gunman, 72-year-old Huu Can Tran, died some 12 hours after the massacre of a self-inflicted gunshot wound inside a white van as a SWAT team closed in on him, Los Angeles County Sheriff Robert Luna said Sunday.

On Monday, investigators searched the gunman’s background as they continue to probe the massacre.

The mayor of Monterey Park said the gunman behind shooting may have been targeting his ex-wife on the Lunar New Year, though that has not yet been officially confirmed.