A 14-year-old North Carolina middle school student was shot on a school bus Wednesday morning, WRAL-TV reported.

Tommy Gray, who identified himself as the teen's father, told the station his son was shot in the upper leg with a .22-caliber gun.

Dustin Gray, a student at Zebulon Middle School, was in good condition at Rex Hospital, officials said.

Another student was being questioned, school spokesman Michael Evans told WRAL. Wake County Sheriff Donnie Harrison said the gun went off accidentally.

"It appears that there was a student who found a handgun at home and was bringing it to school in a bookbag and took it out to show his friend and it discharged," Evans said. "It basically grazed him. We were fortunate that it wasn't more serious."

Evans said the students were "really good friends. The principal told me that the kid who was shot didn't want his friend to get into trouble."

Investigators said the bus driver thought the sound was a tire blowing out and pulled over. That's when the injured student was discovered.

The shooting happened about 6:10 a.m. on Halifax Road near Highway 96 in Youngsville, about 25 miles north of Raleigh.

The school system is sending a message via e-mail to parents in the county system, which is the second-largest in North Carolina behind Charlotte-Mecklenburg County. The system also posted a notice on its Web page about the incident.

Other students on the bus were taken to school.

The Associated Press contributed to this report.

Click here to read more on this story from WRAL.com.