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

The Santa Fe High School shooting suspect told police he spared certain students he liked "so he could have his story told", a court document shows.

Dimitrios Pagourtzis has been charged with murder after 10 people were shot dead on Friday in the Texas town.

According to an affidavit filed in court, Mr Pagourtzis, 17, waived his right to remain silent and admitted "to shooting multiple people".

Authorities said he exchanged gunfire with police before surrendering.

The gun battle went on for about 15 minutes before Mr Pagourtzis gave himself up, abandoning a plan to take his own life, the New York Times reported.

Police now say that eight students and two teachers were killed, with 13 people wounded in the attack, including one of the school's policemen who is in critical condition.

Image copyright Dimitrios Pagourtzis/Facebook Image caption The 17-year-old suspect, Dimitrios Pagourtzis

The details in the affidavit, released by the Galveston County District Attorney's Office, appeared to shed some new light on Mr Pagourtzis's arrest inside the school building.

The documents said he emerged from the school's Art Lab 2 classroom at 08:02 on Friday, about 30 minutes after the first reports of a shooting, and surrendered. Authorities said two apparent improvised explosive devices he brought to the scene turned out to be harmless.

The affidavit also said Mr Pagourtzis was wearing a trench coat and had a Remington 870 shotgun and a .38 calibre pistol. Previous testimony from students described him as wearing a long black trench coat.

One student, Breanna Quintanilla, told the Associated Press that Mr Pagourtzis walked into the classroom she was in, pointed at someone, and said: "I'm going to kill you." Ms Quintanilla was wounded in her leg as she fled.

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

Mr Pagourtzis has been charged with capital murder and aggravated assault of a public servant. The first charge means he could face the death penalty.

He appeared "weirdly non-emotional" on the morning after the shooting, one of his lawyers said on Saturday.

Nicholas Poehl, one of two lawyers hired by the suspect's parents, told Reuters news agency he had spent an hour with the suspect on Friday night and Saturday morning.

"He's very emotional and weirdly nonemotional," the attorney said. "There are aspects of it he understands and there are aspects he doesn't understand."

Mr Pagourtzis's family said in a statement they were "saddened and dismayed" by the shooting and "as shocked as anyone else" by the events. They said they were co-operating with investigators.

Authorities said there were few if any outward signs that Mr Pagourtzis was planning an attack.

"Unlike Parkland, unlike Sutherland Springs, there were not those types of warning signs," said Texas Governor Greg Abbott. "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 30 April he posted a photograph of a T-shirt bearing the slogan "Born to Kill".

Image copyright Sabika Sheikh Family Image caption Pakistani exchange student Sabika Sheikh, 17, was among the dead

None of the victims has yet been identified by US authorities, but some have been named separately. The embassy of Pakistan in Washington DC confirmed that exchange student Sabika Sheikh, 17, was among the dead.

Substitute teacher Cynthia Tisdale was also killed in the attack, her family told US media outlets.

Ms Tisdale's niece and brother-in-law both confirmed the news. Writing on Facebook, John Tisdale said his sister-in-law was an "amazing person".

Ms Sheikh was on the Kennedy-Lugar Youth Exchange & Study Abroad programme (YES). The programme is run by the US state department, and was set up in the aftermath of the 11 September 2001 attacks to bring students from Muslim-majority nations to the US on a cultural exchange.

A vigil was held on Friday night for the victims. A professional athlete from the state - JJ Watt, of the Houston Texans NFL team - offered to pay the funeral expenses of the victims.

The shooting was the fourth deadliest shooting at a US school in modern history, and the deadliest since a student opened fire in February at Marjory Stoneman Douglas High School in Parkland, Florida, killing 17 people.