A 15-year-old student opened fire with a handgun inside a rural Kentucky high school on Tuesday, killing two of his classmates, injuring 17 and sending hundreds fleeing for safety.

Police were seen leading a teenager away in handcuffs and said the suspect will be charged with murder.

It was the country’s first fatal school shooting of 2018.

Students ran for their lives out of Marshall County High School, jumping into cars and running down a highway, some not stopping until they reached a McDonald’s restaurant more than a mile away.

“They was running and crying and screaming,” said Mitchell Garland, who provided shelter to between 50 and 100 students inside his nearby business.

“They was just kids running down the highway. They were trying to get out of there.”

Half a dozen ambulances and numerous police cars converged on the school, along with officers in black fatigues carrying assault rifles.

Federal authorities responded, and Senator Mitch McConnell sent staffers. Governor Matt Bevin rushed from the Capitol to the scene.

Parents left their cars on both sides of an adjacent road, desperately trying to find their teenagers.

Two 15-year-olds were killed. A girl died at the scene, and a boy died later at a hospital, the governor said, adding that all of the victims are believed to be students.

The shooter will be charged with murder and attempted murder, he said.

Police did not release his identity, nor did they describe a motive.

Emergency crews at Marshall County High School after the fatal school shooting (Ryan Hermens/The Paducah Sun via AP)
Emergency crews at Marshall County High School after the fatal school shooting (Ryan Hermens/The Paducah Sun via AP)

“This is a wound that is going to take a long time to heal. For some in this community will never fully heal,” Mr Bevin said.

Five of the wounded were flown about 120 miles (193 kilometres) to Nashville, Tennessee’s Vanderbilt University Medical Centre, spokeswoman Tavia Smith said.

Kentucky State Police have no reason to suspect anyone else, detective Jody Cash told the Murray Ledger & Times.

The attack marked the year’s first fatal school shooting, 23 days into 2018, according to data compiled by the Gun Violence Archive, which relies on media reports and other information.

Mr Bevin said earlier in a statement that “it is unbelievable that this would happen in a small, close-knit community like Marshall County”.

Marshall County High School is about 30 minutes from Heath High School in Paducah, Kentucky, where a 1997 mass shooting killed three and injured five.

Michael Carneal, then 14, opened fire there about two years before the fatal attack at Columbine High School in Colorado, ushering in an era when mass school shootings have become much more common.