An ultra-Orthodox Jewish man has lunged into a group of revelers leading Jerusalem's annual gay pride parade and stabbed six of them as they marched in the city, Israeli police and witnesses said.

The alleged attacker, Yishai Schlissel, had recently been released from prison after serving a term for stabbing several people at a gay pride parade in 2005, police spokeswoman Luba Samri said, adding that he was arrested at the scene of Thursday's attack.

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

The annual parade was proceeding as planned when the crowd's joyful chants 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 as ambulances and police on horses quickly arrived on the scene.

Schlissel was convicted of a similar attack that wounded several people at a gay pride parade in Jerusalem a decade ago. Media reports said that on Thursday he 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 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 a man with stab wounds who was in serious condition and a woman in critical condition, both in their 20s.

Israel's President Reuven Rivlin warned that social intolerance could spell disaster for Israel.

"We must not be deluded a lack of tolerance will lead us to disaster."

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

Jerusalem's annual parade is smaller and more restrained than the annual gay pride march in Tel Aviv, which was attended by some 100,000 revelers last month.

Gays serve openly in Israel's military and parliament, and many popular artists and entertainers are gay, but gays still face hostility among religious Jews.