Media playback is unsupported on your device Media caption How the Texas school shooting unfolded

Ten people have been killed and 10 others injured after a student opened fire at a Texas high school, the state governor said.

The attacker, who was arrested and charged with murder, was identified as Dimitrios Pagourtzis, a 17-year-old pupil at Santa Fe High School.

He allegedly used a shotgun and a revolver taken from his father, who legally owned the weapons.

Most of the dead are students, police said.

Texas Governor Greg Abbott said "various kinds of explosive devices" had been found at the school, 40 miles (65km) south of Houston, and off-campus. They included "a CO2 device" and "a Molotov cocktail", he said.

Mr Abbott said police found information on the suspect's diary, computer, and mobile phone suggesting that he planned the attack and intended to kill himself afterwards.

The governor said the teenager "gave himself up" because "he didn't have the courage to commit the suicide".

Media playback is unsupported on your device Media caption Student: 'I saw a girl that got shot'

Santa Fe Police Chief Jeff Powell advised residents to be aware of any suspicious objects they find. "Do not touch any items that look out of place," he said.

Santa Fe school police officer John Barnes has been named among the injured. He was in a critical condition and undergoing surgery, local media reported.

Also on Friday, one woman died and another was injured in a shooting outside a high school graduation ceremony in in Atlanta.

So far this year, more than 5,000 people have died in shooting incidents in the United States, according to monitoring group the Gun Violence Archive.

Media playback is unsupported on your device Media caption "It broke my heart to see what was going on"

How the attack unfolded

Students said the shooter entered an art class and opened fire shortly before 08:00 (13:00 GMT).

"There was someone that walked in with a shotgun and started shooting," one witness told KTRK-TV, "and this girl got shot in the leg."

One student told local network KHOU-11 that a teacher who realised what was happening activated a fire alarm to evacuate the building.

Dakota Shrader, a student, told CBS News that everyone began running outside when the alarms went off.

Media playback is unsupported on your device Media caption Student: 'I just ran as fast as I could'

"Next thing you know everybody looks, and you hear boom, boom, boom, and I just ran as fast as I could to the nearest floor so I could hide, and I called my mom."

Another student, Damon Rabon, told CBS he looked out of his classroom after hearing loud bangs and saw the shooter. "Black trench coat, short kind of guy, had a sawed-off shotgun," he said.

There were 1,400 students in the school at the time of the attack, according to Lt Gov Dan Patrick.

Shock and grief at a vigil for the victims

Paul Blake in Santa Fe

Hundreds of people gathered at sunset on Friday on a large open lawn near to the school, for a vigil to remember the dead.

The sound of preachers and politicians was intermittently drowned out by wailing and sobs from attendees - still in shock at the violence that had come to this small town of 18,000.

John Overbeck, a final-year student at Santa Fe High School, said he saw a man fall to the ground as he fled the gunman.

"I don't know how to feel. I don't know if it's hit me yet. When something like this happens, it's just so easy to be distracted from it," he told the BBC. "I feel like when I'm isolated later, I'm going to break down."

Much of the area around the school remained cordoned off to the public on Friday evening. Behind the police tape, in the school's car park, vehicles belonging to students and staff sat where they had been left that morning, before the shooting began.

The reaction

President Donald Trump, speaking at a prison reform event at the White House, described the attack as "absolutely horrific".

"My administration is determined to do everything in our power to protect our students, secure our schools, and to keep weapons out of the hands of those who pose a threat to themselves, and to others," he said.

He ordered flags to be flown at half-mast at the White House and all public and military buildings.

Two weeks ago, the US president reiterated his call to arm teachers with guns during a speech in Dallas to the National Rifle Association.

Media playback is unsupported on your device Media caption Trump: 'This has been going on for too long'

Governor Abbott called the shooting "one of the most heinous attacks that we've ever seen in the history of Texas schools".

"It's impossible to describe the magnitude of the evil of someone who would attack innocent children in a school," he said.

First Lady Melania Trump tweeted: "My heart goes out to Santa Fe and all of Texas today."

One professional athlete from the state - JJ Watt, of the Houston Texans NFL team - has offered to pay the funeral expenses of the victims, according to US media reports.

Image copyright BBC/ Google

How does it compare with previous school shootings?

The Texas attack is the deadliest school shooting since a student opened fire in February at Marjory Stoneman Douglas High School in Parkland, Florida, killing 17 people.

That assault spawned a nationwide youth-led campaign for gun control, and a litany of proposed changes:

President Trump moved to ban so-called bump stocks, used in last year's Las Vegas shooting

Congress is considering the "Stop School Violence Act" to provide increased security such as metal detectors in schools

Mr Trump has endorsed arming teachers - a long-held position of the National Rifle Association (NRA)

Gun control advocates have criticised what they see as minor changes, and have continued political support for the NRA.

Earlier this week, a police officer was able to stop a former student who opened fire at an Illinois high school before anyone was injured.

The worst school shooting in US history occurred at Virginia Tech university in Virginia, where 33 people were killed and 25 injured by Sueng-Hui Cho, who committed suicide after the attack.

There have been more deaths in US school shootings so far in 2018 than there have been deaths in the US military, according to an analysis by the Washington Post.

What do we know about the attacker?

Authorities said journals kept by Mr Pagourtzis, 17, showed that he planned to carry out the attack and intended to kill himself afterwards.

But Mr Abbott told reporters that, unlike several previous mass shootings, authorities had not been alerted to Mr Pagourtzis before the attack on Friday.

Media playback is unsupported on your device Media caption Dimitrios Pagourtzis is read his rights after his arrest

"Unlike Parkland, unlike Sutherland Springs, there were not those types of warning signs," Mr Abbott said. "We have what are often categorized as red-flag warnings, and here, the red-flag warnings were either nonexistent or very imperceptible."

Mr Pagourtzis suggested in social media posts that he was an atheist and said: "I hate politics". On April 30 he posted a photograph of a T-shirt bearing the slogan "Born to Kill".

He is being held at Galveston County Jail on a charge of capital murder.

More on US gun violence