A HEAVILY armed man opened fire on his co-workers at a Wisconsin software company, seriously wounding three people before being shot dead by police as employees ran from the building or hid inside, according to investigators.

Middleton Police Chief Chuck Foulke said officers shot the man within eight minutes of receiving calls about an active shooter at WTS Paradigm at around 10am local time.

Foulke said the man was armed with a semiautomatic pistol and extra ammunition, and fired at officers before he was shot.

He said three people were seriously injured during the attack, while a fourth person was grazed by a bullet.

“I think a lot less people were injured or killed because police officers went in and neutralised the shooter,” Foulke said.

The police chief said the motivation behind the attack was unclear and investigators didn’t yet know whether the gunman targeted his victims.

He didn’t release the suspect’s name but said he was an employee of WTS Paradigm and lived in nearby Madison.

Foulke said the investigation was ongoing but noted: “We have reason to believe the suspect was heavily armed with a lot of extra ammunition, a lot of extra magazines.”

Judy Lahmers, a business analyst at WTS Paradigm, said she was working at her desk when she heard what sounded “like somebody was dropping boards on the ground, really loud.”

Lahmers said she ran out of the building and hid behind a car.

She said the building’s glass entrance door was shattered.

“I’m not looking back, I’m running as fast as I can. You just wonder, ‘Do you hide or do you run?”’ she told The Associated Press.

She said she knew one co-worker had been grazed by a bullet but was OK.

She didn’t have any other information about the shooting but said it was “totally unexpected. We’re all software people. We have a good group.”

University Hospital in Madison confirmed that it was still treating three victims from the shooting, saying one was in a critical condition and two were in a serious condition.

Police conducted a secondary search of the office building after the shooting to ensure there were no more victims or suspects - and officers discovered some people still hiding in the building, which also houses Esker Software.

Gabe Geib, a customer advocate at Esker Software, said he was working at his desk when he heard what “sounded like claps.”

He said he then saw people running away from the building at “full sprint.”

“We knew at that point that something was going down. A ton of people were running across the street right in front of us,” he said.

Geib said he and his colleagues were still huddled in their cafeteria, away from windows, more than an hour after the shooting.

Jeff Greene, who also works at Esker, said police told those gathered in the cafeteria to go to a nearby hotel to make a statement about what they saw.

Buying a gun: Australia vs America Buying a gun: Australia vs America

Three yellow school buses full of more than 100 people, including witnesses, were unloaded at a hotel about 8km from the office building.

Some people hugged as they were reunited with loved ones.

Others stopped to pet a dog that had been brought by someone picking up a worker.

WTS Paradigm makes software for the building products industry.

A Wisconsin State Journal profile from 2014 listed company employment at about 145 employees and noted the company was looking to move to a larger location at the time.

The company’swebsite was down on Wednesday.

A shopping centre next to the building was temporarily put on lockdown at the direction of police.

On the same day, another person was killed and four others injured after a shooting at a Pennsylvania courthouse.

Four people who were shot at the Fayette County Magistrate Court in Masontown, Pennsylvania, on Wednesday afternoon local time and were taken to hospital for treatment, a spokesman for the Fayette County Emergency Management told ABC News.