Revelers dancing and singing through the streets of Jerusalem during the holy city's annual gay pride parade were left shrieking in pain and panic Thursday night, as an anti-gay extremist lunged into a group leading the march and stabbed six people, Israeli police and witnesses said.

Police said the attacker, Yishai Schlissel, who was arrested at the scene for Thursday's attack, had been released from prison just three weeks ago, after serving a sentence for stabbing several people at the parade in 2005.

Six people were wounded in the attack, two of them seriously, Eli Bin of Israel's emergency service said.

The Gay Pride Parade was proceeding as planned with party music, Israeli flags and rainbow-clad marchers wending their way through central Jerusalem's barricaded streets, under a heavy police presence.

An Associated Press photographer witnessed the attacker enter the throng of people with his hand in his coat and within seconds raise a knife and begin stabbing people in the back. Police pounced on him and arrested him.

The crowd's carefree cheers suddenly gave way to screams. Panic ensued, and a bloody woman fell to the ground, an Associated Press photographer at the scene said.

A man with blood seeping from his back wandered around with a dazed look before collapsing. Another man with his shirt off also had blood dripping down his back. Medics quickly surrounded them both and applied pressure to stop the bleeding.

Shocked revelers, some in tears, gathered along the sidewalk and hugged and comforted each other as ambulances and police on horses quickly arrived.

While the attack caused shock, it was not unprecedented: Schlissel was convicted of a similar stabbing attack that wounded several people at a gay pride parade in Jerusalem a decade ago.

On Thursday, media reports said that Schlissel hid in a nearby supermarket and jumped out to attack the march when it passed nearby.

Jerusalem police spokesman Asi Ahroni said there was a "massive presence" of police securing the parade but "unfortunately the man managed to pull out a knife and attack."

A medic that treated the wounded at the scene, Hanoch Zelinger, said one woman was stabbed in the back, chest and neck, and was lying unconscious on the ground.

Shaarei Tzedek Hospital said it was treating two victims with stab wounds, a man who was in serious condition and a woman in critical condition, both in their 20s.

The parade continued after the wounded were taken for treatment, but in a far more somber atmosphere. Media reported that thousands of Jerusalem residents who had not initially participated in the parade joined in after the attack in solidarity.

"I do think that homophobia is rooted in the city, but that's the point of the parade," said Benny Zupick, 21, shortly after the attack. "We are trying to change that. And hopefully we will change that. It takes one man to create a scene like this. Hopefully he's a minority."

Condemnations of the attack poured in from the heads of Israel's ultra-Orthodox parties, along with Prime Minister Benjamin Netanyahu, Defense Minister Moshe Yaalon and others across the Israeli political spectrum.

President Reuven Rivlin called the attack a "terrible hate crime."

"People celebrating their freedom and expressing their identity were viciously stabbed. We must not be deluded; a lack of tolerance will lead us to disaster. We cannot allow such crimes, and we must condemn those who commit and support them," Rivlin said.

Just a few thousand people usually attend the parade in Jerusalem, known for its rich religious history and tradition. A majority of Jerusalem's residents are observant Jews, Muslims or Christians, conservative communities whose members mostly frown on homosexuality. Previous parades in the holy city have drawn opposition.

Jerusalem's parade is much smaller and more restrained than the annual gay pride march in the secular Tel Aviv, which was attended by some 100,000 revelers last month. Tel Aviv has emerged as one of the world's most gay-friendly travel destinations recently. The Israeli city stands in sharp contrast to most of the rest of the Middle East, where gays are persecuted or even killed in some places.

Gays serve openly in Israel's military and parliament, and many popular artists and entertainers are gay, but gays still face hostility from some ultra-conservative religious communities.

Israel's Channel 2 TV aired an interview that Schlissel gave to an ultra-Orthodox Jewish site recently where he spoke out against the gay parade taking place in Jerusalem. His remarks were an eerie prelude to Thursday's attack.

"The struggle isn't over and the un-pure want to contaminate Jerusalem," he said. "They want to contaminate the people of Israel."