A star baseball player was shot in the head during the Texas school shooting but survived as the hero cop who confronted him remains in stable condition.

Rome Shubert, a University of Houston baseball commitment and a sophomore pitcher for Santa Fe High School, was shot in the back of the head, but was well enough to tweet about the tragedy Friday afternoon.

'I'm so greatful and blessed that god spared me life today,' he wrote. 'Today I was shot in the back of the head but i am completely okay and stable.'

He told the Houston Chronicle was in his classroom when gunshots rang out.

Rome Shubert (pictured left and right), a University of Huston baseball commitment and a sophomore pitcher for Santa Fe High School, was shot in the head

'I'm so greatful and blessed that god spared me life today,' he wrote after the shooting in Santa Fe

'I was sitting doing my work and he walked in, tossed something on the desks behind me,' Shubert, who has returned from hospital, added. 'Then three loud pops and I jumped under my table and flipped it in front of me and I guess he ran out in the hall and I took off out the back door and when I was running I realized I was shot in the back of my head.'

The teen said he was so scared and he had so much adrenaline, he didn't realize he had been shot at first. The bullet 'missed everything vital'.

In a follow-up tweet, Shubert wrote: 'Thank you for all your prayers and the support. Prayers going out to all the others who are affected.'

John Barnes, 49, a retired Houston police officer now working as the Santa Fe resource officer and was first to confront him, was shot in the elbow and was hospitalized in critical condition.

Hero cop: Santa Fe school resource officer John Barnes, 49, pictured above with his wife, is in surgery after engaging the shooter and suffering a gunshot wound to the arm

Dimitrios Pagourtzis, 17, has been arrested

Dr. David Marshall, chief nursing officer at University of Texas Medical Branch in Galveston, said Friday afternoon Barnes is in stable condition.

Marshall says a bullet hit Barnes’ arm, damaging the bone and a major blood vessel around his elbow. He says the blood vessel has been repaired, and that Barnes is expected to emerge from surgery within a few hours.

Houston Police Chief Art Acevedo tweeted that Barnes, who is married, was sworn in as an officer in 1995 and retired from the force this past January.

Dimitrios Pagourtzis, a 17-year-old high school junior, allegedly burst into an art classroom at his school yelling 'Surprise!' while brandishing his father's shotgun and pistol, before opening fire and gunning down nine students and a teacher.

Pagourtzis was clad in a 'Born to Kill' T-shirt when he embarked on his rampage during first period at Santa Fe High School in Texas, police say.

He subsequently surrendered when confronted by police, who say he backed out of his original plan to commit suicide at the end of the massacre, but not before planting explosives around the school.

Santa Fe High School in Texas was on lockdown after a shooter stormed into a class and killed 10 people Friday morning

Police subsequently released a mugshot of dead-eyed Pagourtzis who is being held without bond in the Galveston County jail on charges of capital murder and aggravated assault of a peace officer.

As well as being accused of killing 10, he also injured 10 more.

Officials are also questioning two other students who were detained after the shooting. They have not been named.