The 18-year-old student killed in a shooting at a suburban Denver school was a high school senior days away from graduating, police said as they continued to search for a motive in the attack that also wounded eight people.

The slain man was Kendrick Castillo, a robotics enthusiast, ABC News reported on Wednesday citing the teen's father, John Castillo.

Douglas County sheriff Tony Spurlock told a morning news conference that one of the suspected shooters at the Science, Technology, Engineering and Math (STEM) School in Highlands Ranch, previously identified as male, was a female under the age of 18. The other suspect was Devon Erickson, 18, he said.

Spurlock declined to identify the person slain in the attack. John Castillo could not be reached for immediate comment.

The reason for the attack remained unclear, Spurlock said.

Denver's ABC television affiliate, citing an unidentified police source, reported on Tuesday that one of the suspects wanted to transition to male from female and had been bullied for it.

Spurlock declined to answer a reporter's question about whether the younger suspect was transgender.

‘Right now we are identifying the individual as a female, because that's where we're at,’ he said. ‘We originally thought the juvenile was a male by appearance.’

Spurlock said the suspect had been identified as male ‘before the detectives were able to get the medical - and detectives were able to speak to her.’

Erickson was expected in Douglas County District Court in nearby Castle Rock at 1:30 p.m. MDT (1830 GMT). The second suspect also will appear in court on Wednesday, said District Attorney George Brauchler.

The two suspects opened fire in two separate classrooms and were arrested within minutes at the public charter school about 25 miles (40 km) south of Denver, Spurlock said.

‘A student's life was taken too soon by this act of violence,’ Colourado Governor Jared Polis said at a news conference. ‘I share the heartbreak, the frustration, the sickness.’

Some of the worst mass shootings in the United States have occurred in Colourado.

The attack occurred less than a month after the 20th anniversary of the Columbine High School massacre in nearby Littleton, about 5 miles (8 km) from the Highlands Ranch school.

In 2012 a man opened fire at a movie theater in Aurora, another Denver suburb, killing 12 people and wounding scores more.

What happened inside the STEM school remains unclear.

Spurlock said there was a ‘struggle’ as officers entered the building and some students said one victim was shot in the chest as he tried to tackle a shooter.

A man who identified himself as Fernando Montoya said his 17-year-old son, a junior at STEM, was shot three times when a shooter walked into his classroom and opened fire.

‘He said a guy pulled a pistol out of a guitar case and started to shoot,’ Montoya told the Denver TV station.

The bloodshed shocked the affluent suburb of Highlands Ranch. Parents and students had considered the school a safe place for its 1,850 pupils ranging from kindergarten to 12th grade.

The attack came a week after a gunman opened fire on the Charlotte campus of the University of North Carolina, killing two people and wounding four others.