PITTSBURGH - A gunman who opened fire after entering the lobby of a U.S. psychiatric hospital on Thursday was armed with two semiautomatic handguns during a confrontation that left two people, including the gunman, dead and several others wounded, the mayor said.

Pittsburgh Mayor Luke Ravenstahl said the man exchanged gunfire with police and was shot dead, but not before one other person was killed and seven hurt, apparently by his gunfire. One injured person wasn't hurt by gunfire.

The mayor stopped short of confirming the gunman was fatally shot by a University of Pittsburgh police officer. But he confirmed "police acted admirably and did engage in gunfire."

One of the injured was a police officer who Ravenstahl said was grazed by a bullet. Others injured included employees and a visitor, said Dr. Donald Yealy, chair of emergency medicine at the university's medical school.

Gregory Brant said he was in a waiting room on the first floor when pandemonium broke out.

"We heard a bunch of yelling, some shooting, people yelling, 'Hide! Hide!" he said. "Everyone's yelling, 'Stay down!"'

Brant, 53, and six others, including a young girl and her parents, barricaded themselves inside the waiting room. They crouched in a corner, hoping the gunman wouldn't see them as he went past, Brant said.

"We were kind of sitting ducks," Brant said. "Luckily, he didn't see us in there, and we didn't make eye contact with him."

Neighbouring buildings were placed on lockdown for hours, police said.

The University of Pittsburgh Medical Center said it had received some patients from the shooting. It said two were in intensive care, two were released and three were being admitted. All were expected to survive.

The clinic, Western Psychiatric Institute and Clinic, is affiliated with the University of Pittsburgh Medical Center and one of several affiliated hospitals adjacent to the university campus.