A heavily armed man with an apparent grudge against white women invaded a hotel bar near the University of California campus Thursday, killing one student and wounding at least seven other people.

The gunman held as many as 20 people hostage as he kept police at bay in a standoff that lasted for nearly seven hours, authorities said.Police shot the gunman as he walked out of the bar shortly after 7 a.m. Paramedics rushed the wounded man away as hostages streamed out into the street.

"He just came out. We just shot him," police Capt. Philip Doran said. "We're getting hostages out now."

The man began shooting sporadically at patrons inside Henry's bar in the Durant Hotel, a block south of the UC Berkeley campus, shortly after midnight, Doran said.

He spent the next seven hours firing sporadically and killing time by sexually harassing his white female hostages, witnesses said.

Phil Kim, an architecture student who escaped early in the siege, said the gunman forced female hostages to "drop their pants" and forced the male hostages to sexually molest them "with carrots he brought with him.

Initially, more than 20 people were held hostage at gunpoint, but several escaped or were allowed to leave as the standoff continued, leaving about 20 patrons inside with the gunman.

Two women released from the bar said the gunman appeared irrational and ordered non-white appearing women to "run out and tell the police . . . that they had done this to me. This isn't my fault I wrote several letters to your FBI."

They said he ordered male hostages to "sit up by the windows."

Several blonde women, they said, were ordered to "take off their pants."

"After the girls took off their pants, at least the blondes, he had them do something sexually perverse," one of the former hostages said.

Local hospitals reported receiving at least eight gunshot victims. One of them, John G. Sheehey, 22, a UC Berkeley student, died of his wounds.