A woman opened fire with a handgun in a courtyard at YouTube headquarters in California, wounding three people before fatally shooting herself in what is being investigated as a domestic dispute, authorities said.

Nasim Aghdam, who used the name Nasime Sabz on Instagram and Facebook appeared to bear a grudge because she was no longer getting money from YouTube video hits, the Mirror reports .

Terrified employees huddled inside, calling 911, as officers and federal agents swarmed the company's suburban campus sandwiched between two interstates in the San Francisco Bay Area city of San Bruno.

YouTube employee Dianna Arnspiger said she was on the building's second floor when she heard gunshots, ran to a window and saw the shooter on a patio outside.

Dianna Arnspiger said the woman wore glasses and a scarf and was using a "big huge pistol."

"It was a woman and she was firing her gun. And I just said, 'Shooter,' and everybody started running," Arnspiger said.

She and others hid in a conference room for an hour while another employee repeatedly called 911 for updates.

"It was terrifying," she said.

Authorities gave few details about the shooter and victims, except that the gunfire was being investigated as a domestic dispute, two law enforcement told The Associated Press.

A 36-year-old man was in critical condition, a 32-year-old woman was in serious condition and a 27-year-old woman was in fair condition, a spokesman for San Francisco General Hospital said.

Witnesses described terror before officers arrived and discovered a victim near a front door and then found the shooter several minutes later with what appeared to be a self-inflicted gunshot wound, San Bruno Police Chief Ed Barberini said.

He said two additional gunshot victims were found at an adjacent business minutes later. Mr Barberini initially said there were four people who had been shot but later clarified that a fourth person had suffered an ankle injury.

Zach Vorhies, 37, a senior software engineer at YouTube, said he was at his desk working on the second floor of one of the buildings when the fire alarm went off. He got on his skateboard and approached a courtyard, where he saw the shooter yelling, "'Come at me, or come get me'."

He saw somebody lying nearby on his back with a red stain on his stomach that appeared to be from a bullet wound. Mr Vorhies said he realised there was an active shooter when a police officer with an assault rifle came through a security door.

He said the public can access the courtyard where he saw the shooter during work hours.

Aghdam was pictured at a PETA (People for the Ethical Treatment of Animals) rally in San Diego paper over the use of pigs in military training in 2009.

On her now defunct YouTube page, the 39-year-old described herself as "the Persian Azeri female vegan athlete and animal rights activist promoting VEGANISM, the healthy and humane way of living."

"Nasim produced and launched the first vegan Persian TV commercial and first Persian animal rights music video (Do You Dare) in 2010, International persian satellite television, Andisheh TV.

"Nasim is the well known and most famous animal rights activist in persian / turkish community."

Last February she posted a picture which appeared to show Aghdam holding a home-made protest sign which read: "Youtube dictatorship. Hidden policy: promote stupidity, discrimination, suppression of truth

Read More

Early reports were that the shooter may have targeted a boyfriend but it is now understood Aghdam was not known by anyone at YouTube.

CBSNews said Aghdam's father Ismail told them his daughter had been missing for several days and he'd told police she was "angry" at YouTube.

He said police contacted him to say Aghdam had been found in Mountain View, where Google has its headquarters, on Monday night.

Mr Aghdam said YouTube "stopped everything and now she has no income."

SWAT teams rushed to the scene within minutes of receiving the first emergency calls at around 12.46pm.

They first found a man with gunshot wounds who was transported to hospital.

The woman shooter was then found dead from what appears to be a self-inflicted gunshot wound.

Pictures later emerged showing a body, covered with yellow tarpaulin, near to a shattered door.

Two more victims were later found as police searched the building and were also taken to hospital with gunshot wounds.

Chief Ed Barberini said the scene was "very chaotic".

He said they were "hopeful" that all those injured will survive.

A spokesman for San Francisco General Hospital later said of the three patients; a 36-year-old man is in a "critical" condition, a 32-year-old man is "serious" and a 27-year-old woman is described as "fair".

Witnesses claimed the shooter was a white, adult female wearing a dark top and head scarf, according to ABC7 News .

Workers at YouTube, owned by Google's Alphabet Inc, said the incident appeared to have begun outside near a cafeteria.

They told of meetings suddenly coming to a stop as staff saw colleagues running towards emergency exits of the building which houses around 1,700 emloyees.

Television images showed staff walking in lines with their hands above their heads as armed police surrounded the scene.

Product manager Todd Sherman told of seeing "blood on the stairs" as he fled the building.

He wrote: "We were sitting in a meeting and then we heard people running because it was rumbling the floor. First thought was earthquake.

"After exiting the room we still didn’t know what was going on but more people were running. Seemed serious and not like a drill.

"We headed towards the exit and then saw more people and someone said that there was a person with a gun.

"At that point every new person I saw was a potential shooter. Someone else said that the person shot out the back doors and then shot themselves.

"I looked down and saw blood drips on the floor and stairs. Peaked around for threats and then we headed downstairs and out the front.

"Police cruisers pull up, hopped out with rifles ready and I told them where the situation was as I headed down the street to meet up with a couple team members."

Video Loading

Video Unavailable

Click to playTap to play

The video will start in 8Cancel

Play now

Michael Finney, a 21-year-old supervisor at Carl's Jr across from the campus, said he came out of the bathroom to see a woman in a booth bleeding from the calf. Two friends were trying to stop the bleeding, using the victim's sweatshirt as a tourniquet, but it was not helping, he told the San Jose Mercury News.

"Everyone was figuring out what to do," Mr Finney said. "I was trying to stay calm and see what I could do. Everybody is shocked."

Google, which owns the world's biggest online video website, said the company's security team worked with authorities to evacuate buildings and was doing whatever it could support the victims and their families.

YouTube's headquarters has more than a thousand engineers and other employees in several buildings. Originally built in the late 1990s for the clothing retailer Gap, the campus south of San Francisco is known for its sloped green roof of native grasses.

Inside, Google famously outfitted the office several years ago with a three-lane red slide for workers to zoom from one story to another.

"Today it feels like the entire community of YouTube, all of the employees, were victims of this crime," said Chris Dale, a YouTube spokesman. "Our hearts go out to all those who suffered."

The White House said President Donald Trump was briefed on the shooting and that officials were monitoring developments.