A 17-year-old armed with a shotgun and a pistol opened fire at a Texas high school on Friday, killing 10 people, most of them students, authorities said.

The shooting at the Santa Fe High School was the nation’s deadliest such attack since the massacre in Florida that gave rise to a campaign by teenagers for gun control.

The suspected shooter, who was in custody on murder charges, also had explosive devices that were found in the school and nearby, said Governor Greg Abbott, who called the assault “one of the most heinous attacks that we’ve ever seen in the history of Texas schools”.

Investigators offered no immediate motive for the shooting.

The governor said the assailant intended to kill himself but gave up and told police that he did not have the courage to take his own life.

The deaths were all but certain to re-ignite the national debate over gun regulations, coming just three months after the Parkland, Florida, attack that killed 17 people at Marjory Stoneman Douglas High School.

A woman wearing a Texas t-shirt holds a lighted candle during a vigil (Stuart Villanueva/AP)
A woman wearing a Texas t-shirt holds a lighted candle during a vigil (Stuart Villanueva/AP)

“It’s been happening everywhere. I’ve always kind of felt like that eventually it was going to happen here, too,” Santa Fe High School student Paige Curry told Houston television station KTRK. “I don’t know. I wasn’t surprised. I was just scared.”

Another 10 people were wounded at the school in Santa Fe, a city of about 13,000 people roughly 30 miles southeast of Houston, the governor said.

The wounded included a school police officer who was the first to confront the suspect and got shot in the arm.

Dimitrios Pagourtzis was taken into custody and identified as the suspect in the deadly school shooting in Santa Fe (AP)
Dimitrios Pagourtzis was taken into custody and identified as the suspect in the deadly school shooting in Santa Fe (AP)

Zachary Muehe was in his art class when he heard three loud booms.

He told The New York Times that a student he knew from football was armed with a shotgun and was wearing a shirt emblazoned with the slogan “Born to Kill.”

“It was crazy watching him shoot and then pump. I remember seeing the shrapnel from the tables, whatever he hit. I remember seeing the shrapnel go past my face,” he told The Times.

Michael Farina, 17, said he was on the other side of campus when the shooting began. He heard a fire alarm and thought it was a drill.

Santa Fe High School freshman Kylie Trochesset, left, and her mother, Ashlee, wipe away tears during a prayer vigil (David J Phillip/AP)
Santa Fe High School freshman Kylie Trochesset, left, and her mother, Ashlee, wipe away tears during a prayer vigil (David J Phillip/AP)

He was holding a door open for special education students in wheelchairs when a principal came bounding down the hall and telling everyone to run. Another teacher yelled out, “It is real!”

Students were led to take cover behind a car shop across the street from the school. Some still did not feel safe and began jumping the fence behind the shop to run even farther away, Mr Farina said.

“I debated doing that myself,” he said.

The gunman yelled “Surprise” before he started shooting, according to Texas Representative Michael McCaul, the chairman of the House Homeland Security Committee.

Law enforcement officers respond to Santa Fe High School after an active shooter was reported on campus (Steve Gonzales/AP)
Law enforcement officers respond to Santa Fe High School after an active shooter was reported on campus (Steve Gonzales/AP)

The suspect was identified as Dimitrios Pagourtzis, who appeared to have no prior arrests or confrontations with law enforcement.

He made his initial court appearance on Friday evening by video link from the Galveston County Jail. A judge denied bond and took his application for a court-appointed attorney.

Mr Pagourtzis played on the junior football team and was a member of a dance squad with a local Greek Orthodox church.

Acquaintances described him as quiet and unassuming, an avid video game player who routinely wore a black trench coat and black boots to class.

The suspect obtained the shotgun and a .38-caliber handgun from his father, who owned them legally, Mr Abbott said. It was not clear whether the father knew his son had taken them.

The assailant’s homemade explosives included pipe bombs, at least one Molotov cocktail and pressure-cooker bombs similar to those used in the Boston Marathon attack, authorities said.

Survivors of the Florida attack took to social media to express grief and outrage in the aftermath.

“My heart is so heavy for the students of Santa Fe High School. It’s an all too familiar feeling no one should have to experience. I am so sorry this epidemic touched your town — Parkland will stand with you now and forever,” Marjory Stoneman Douglas student Jaclyn Corin said in a tweet.

She also directed her frustration at President Donald Trump, writing “Our children are being MURDERED and you’re treating this like a game. This is the 22nd school shooting just this year. DO SOMETHING.”

In the aftermath of the Florida assault, survivors pulled all-nighters, petitioned city councils and state politicians, and organised protests in a grass-roots movement. Within weeks, politicians adopted changes, including new weapons restrictions.

In late March, the teenagers spearheaded one of the largest student protest marches since Vietnam in Washington and inspired hundreds of other marches from California to Japan.

The calls for tighter gun controls have barely registered in gun-loving Texas — at least to this point.

Texas has some of the most permissive gun laws in the US and just hosted the National Rifle Association’s annual conference earlier this month.

In the run-up to the March primary election, gun control was not a main issue with candidates of either party.

Republicans did not soften their views on guns, and Democrats campaigned on a range of issues instead of zeroing in on gun violence.