A St. Paul first-grader who brought a gun to school, where it went off in a classroom filled with students, found it in a drawer in the family's home, police said Friday.

The 7-year-old boy showed the .38-caliber revolver to some students at Crossroads Elementary on Thursday and at least two of his classmates handled it, said police spokesman Sgt. Mike Ernster. While in the hands of an 8-year-old boy, the gun discharged into the classroom floor, he said.

Twenty-seven students and a teacher were in the classroom at the time. No one was injured.

"There was no malice. It wasn't directed toward anyone," Ernster said. "It went off. It may have been an intentional act of firing the gun, but he didn't know the consequence of it. It wasn't intended for anybody," he said.

The 7-year-old and the aunt and uncle he lives with are cooperating with police. Although the investigation is ongoing, Ernster said it appears that the boy found the gun, which belongs to his aunt, in a bedroom drawer.

Investigators are working to determine how the boy got hold of the gun and what could have been done to prevent the incident.

"If it's determined that the gun was stored improperly, allowing this child to obtain it, then that information will be forwarded to the county attorney's office to be considered for charges," Ernster said.

"Today we got lucky," police said in a statement released Thursday. "But this incident should still serve as a powerful reminder to anyone who owns a gun to keep it safe, secure and out of the hands of children."

School staff confiscated the gun immediately, said St. Paul Public Schools spokeswoman Toya Stewart Downey.

The principal e-mailed a letter to Crossroads families and put out a robocall informing all school families of the situation. The principal also called or talked to families of students who witnessed the gun going off.

"Understandably, students were upset," principal Celeste Carty wrote. "Our district crisis team and the police reassured the students that they were safe, that everything was OK, and answered questions."

Downey said that any consequences for the child will follow standard discipline procedures.

Crossroads is located on Front Avenue, just east of Dale Street N. It operates year-round on a schedule of 45 days on and 15 days off. The school is now in "intersession," focusing on math, reading and writing instruction.