LAHORE, Pakistan (AP) _ As he prepared to hand out copies of the Koran during a memorial service in a Shiite Muslim cemetery Sunday, prayer leader Allama Aktar Abbas Najvi paused to offer a warning. ``We must be very cautious,'' he said. ``We are not safe here in Pakistan.''

Moments later, he proved prescient: Two gunmen on a motorcycle roared up to the service in Lahore and turned their rifles on the mourners, killing 24 people and injuring more than 30 in an attack officials fear was religiously motivated.

People scrambled for cover: Children hid behind the gravestones, some beneath colorful chadors, or shrouds, draped over the stone markers. Screams and pleas for the gunmen to stop filled the air.

``We were in the middle of our prayers,'' said a trembling Imam Hassan, 52. ``Everyone started screaming and trying to find a place to hide, but they just kept on firing.''

Most of Pakistan's 140 million people are Sunni Muslims who hold no grudge against their Shiite brethren. Small, well-armed militant groups have emerged, however, and the two sides routinely clash.

No one has claimed responsibility for the attack, but police suspect the gunmen belonged to the Sunni group known as the Sipah-e-Sahabah, or the Friends of the Guardians of the Prophet.

``There is no doubt that Sipah-e-Sahabah was involved in the firing and there will definitely be repercussions,'' said Hasan Turabi, a leader of the Tehrik-e-Jafria, or Movement for Shiite Muslim Law in Pakistan. Contacted by The Associated Press by telephone, he would not elaborate.

The massacre came as nearly 100 Shiite Muslim worshipers were kneeling at the white marble grave of their former leader and teacher, Mohammed Hussein Rizwan, during a ceremony marking his death two years ago from natural causes. As the gunmen sprayed bullets over the crowd, two accomplices kept watch from a jeep.

After the killers led, survivors hurried from the cemetery, stopping cars, motorized rickshaws and motorcyclists, pleading with them to rush the wounded to the nearest hospital.

Loudspeakers at Lahore's Mayo Hospital blared out a call for blood donations. Dozens of people, both Sunni and Shiite Muslims, lined up to help.

Police, who took about an hour to get to the graveyard, cordoned off the area. The Punjab government called an emergency meeting of law enforcement officials and ordered a judicial inquiry.

``We will find these terrorists, whoever they are,'' Chief Minister Shahbaz Sharif said.

Nearly 300 people have been killed in religiously motivated violence in the past year. Most of the killings have occurred in Pakistan's Punjab province, the country's most populous.

Authorities, fearing retaliatory attacks, deployed police at mosques throughout the country, and plainclothes officers were dispatched to many congested shopping districts in Lahore.

In the capital, Islamabad, police set up roadblocks, where they stopped vehicles and searched for weapons. Paramilitary Rangers were deployed in the old city of Karachi, where there is a large Shiite Muslim population.

At sunset, a mob converged near the scene of the attack, and pelting businesses with stones and set fire to a bank and a car as demonstrators vowed revenge for the killings. There were no injuries.

Turabi said the Punjab administration had failed the minority Shiite community.

``They are not doing their duty to protect us,'' he said.