Gunfire erupted inside an East Oakland church during a funeral Tuesday for an 18-year-old man slain at his birthday party, but no one was struck by bullets, police said.

The shooting happened about 12:20 p.m. inside the Cosmopolitan Baptist Church at 988 85th Ave., where more than 300 mourners were attending a funeral for Davante Riley, said Officer Holly Joshi, an Oakland police spokeswoman.

Riley was shot and killed earlier this month, allegedly by a 15-year-old girl who was at his party.

"Everybody started shooting," said a mourner who asked that she be identified only as Shawnie. "Some people came from another area that didn't get along with (Riley's) group or whatever. Everybody was running. Everybody was scared."

Officers arrived and found "several people outside engaged in a fight, and several of those people were armed," Joshi said.

Police put out a citywide emergency call, drawing officers from throughout Oakland as well as Alameda County sheriff's deputies, state parole agents and the Oakland Housing Authority, Oakland schools and San Leandro police.

Officers wore riot gear outside the church.

"It's very shocking," said Lisa Taylor, administrator of the Whitted-Williams Funeral Home in Oakland, which organized the funeral service. "I'm sure the family is in shock. They're trying to have closure of their loved one."

Witnesses and police said the shooting happened as the funeral was drawing to a close. Numerous people pulled out weapons as mourners were getting ready for the procession to a Hayward cemetery.

Shots were fired in the church, and as people fled, there was a "large-scale fight in the middle of the street," Joshi said.

"We are very lucky that no one was hit by these bullets," Joshi said.

Several people were taken to hospitals after complaining of pain, possibly as a result of injuries sustained while trying to flee the gunfire, police said.

Police arrested five people for firearms-related and other offenses and recovered several weapons, Joshi said.

Riley was shot and killed at an apartment on the 2200 block of East 20th Street, near 23rd Avenue, at about 12:15 a.m. April 18, the day after he turned 18, police said.

The girl apparently did not intend to shoot Riley, but she was charged as a juvenile with murder because she acted recklessly in pointing a .22-caliber gun at Riley and firing, said Assistant District Attorney Matt Golde. He declined to elaborate on the circumstances that led to the slaying.

The girl's name has not been released because of her age.