Two 15-year-old students were wounded Friday afternoon in what may have been an accidental shooting inside a charter high school in Logan, Philadelphia police said.

One of the victims, a girl who was shot through the arm, was treated at Einstein Medical Center, just blocks away from Delaware Valley Charter High School, where the shooting occurred. She was released from the hospital later in the day.

The second victim, her boyfriend, was struck by the same bullet, which lodged in his shoulder, police said. He remained at the hospital Friday night.

The shooting, which sent parents scrambling to find out if their children were safe, came two days after a 17-year-old boy was arrested for bringing a loaded handgun to a West Philadelphia charter school.

A boy who was originally a suspect and was detained by police near his South Philadelphia home was later cleared, said Police Commissioner Charles H. Ramsey.

Another suspect, a student, turned himself in at Northwest Detectives, and a third boy from the school was still being sought, Ramsey said.

A high-ranking law enforcement source said the shooting might have been accidental.

It took place just before 3:30 p.m. in the gym at Delaware Valley Charter High, 5201 Old York Rd.

Roughly seven students were in the gym at the time of the incident, though no class was taking place. Then, Ramsey said, a gun was discharged by one of the students. The student then fled the building, Ramsey said.

A law enforcement source said the student had pulled the gun out of a book bag when the shooting occurred.

"It appears they might have been playing with it," the source said.

Ramsey said it was unclear how many shots had been fired.

"In this day and age, one of the first things you think about is an active shooter," Ramsey said. "This one worked out for us."

Ramsey said he did not know if the charter school had metal detectors, but "clearly the gun got in, so there was a breakdown of security."

Citing the most recent incident of gun violence, at a school in Roswell, N.M., Ramsey said it was "becoming far too common."

"The one place that should be safe and secure is a school," he said.

Agents from the federal Bureau of Alcohol, Tobacco, Firearms, and Explosives joined the investigation and were at the school Friday evening.

Many students had already been dismissed when the shooting occurred. The remaining students were placed in lockdown until it was clear there was no active shooter and the building had been thoroughly searched.

Students were patted down one by one as they left the school. Parents and relatives clustered outside after news of the shooting.

Keisha Thompson, 40, was waiting anxiously for her 18-year-old son and 16-year-old daughter.

"My stomach is in knots," she said.

"My daughter called. She said the school was on lockdown. They heard shots," Thompson said.

She said her daughter and other students were being kept in a locked room.

"I don't care about the shooter. I just want my kids," Thompson said.

Frank Thorne, 39, whose 16-year-old daughter and 14-year-old nephew were inside the school building late Friday afternoon, was angry.

"I'm flabbergasted that a child or whoever brought a gun to school," Thorne said.

He said his daughter had been complaining about being unhappy at Delaware Valley.

"I'm finally listening. She's got to go," Thorne said.

Thompson said the school had a reputation for being a place where students could feel safe.

She had another son graduate last year and a niece several years earlier.

"There's never been violence here like this," she said.