A recent breakup may have pushed a student with a history of aggressive actions to shoot and seriously injure a 15-year-old girl in the cafeteria of their Texas high school on Monday, officials said.

Multiple students and a parent told FOX4 News the 16-year-old suspected gunman at Italy High School was in a relationship with the victim, but the pair had recently broken up. The students and parent told FOX4 the teenager was very upset about the breakup.

“I did know that the guy that was shooting was mad at the girl because she had left him for somebody else,” Danaisia McCowan told FOX4. “So he shot at one guy and missed him, and then he shot at her.”

The suspect, whose name has not yet been released by police, appeared in court Wednesday after being charged with two counts of aggravated assault with a deadly weapon. The judge ordered the 16-year-old to remain in juvenile detention on the grounds that he is a danger to himself and others and does not have adequate supervision. He will undergo a psychological evaluation before his next detention hearing on Feb. 7, according to FOX4.

The 16-year-old's parents were in court, along with the victim’s mother but cameras were not allowed because he is a juvenile, FOX 4 reported. The suspect's name and mugshot also will not be released. Officials have not yet announced if the case will remain in juvenile court, or whether prosecutors will charge him as an adult.

Ellis County sheriff's Sgt. Joe Fitzgerald told the Associated Press officials would inquire about any dating history involving the two as part of the investigation. Fitzgerald also said officials know where the handgun used in the shooting was obtained, but declined to publicly reveal that information.

The 15-year-old girl who was wounded in the gunfire is in "good spirits," Italy Independent School District Superintendent Lee Joffre said Tuesday after making a visit at a Dallas hospital.

"It is an amazing demonstration of her strength that she was able to survive this," he told reporters.

TEXAS HIGH SCHOOL SHOOTING LEAVES 1 STUDENT WOUNDED; SUSPECT IN CUSTODY, POLICE SAY

While officials have not officially released the name of the girl, an off-duty Dallas firefighter is being credited with helping to save her life.

Capt. Charles Hyles told FOX4 News his kids go to the high school, and when he heard what happened Monday he ran inside the school to help. That's when he found the girl shot four times on the ground in the cafeteria.

"She was saying, please don't let her die. We told her we would not let her die,” Hyles said. “I felt a special bond with her. When she made me promise she wasn't going to die, I needed to follow up on my promise that I would see her at the hospital."

Noelle Jones suffered injuries that "range from a bullet lodged in her neck, another removed from her abdomen to a foot of unrepairable small intestine having to be removed," according to a GoFundMe page set up to help her family with medical expenses.

Fellow students said the shooter had a violent history, and one parent told FOX4 she had complained to school administrators after the same boy threw scissors at her daughter in anger.

Cassie Shook, a 17-year-old junior at the school, told the AP she was angry when she learned who the suspect was because she'd complained about the boy at least twice to school officials, including to a vice principal.

"This could have been avoidable," she said. "There were so many signs."

RECENT SCHOOL SHOOTINGS IN THE US

Shook said she first went to school officials after the boy allegedly made a "hit list" in eighth grade and her name was on it. Then last year, the boy got angry during a class and threw a pair of scissors at her friend and later threw a computer against a wall, she said.

Joffre has repeatedly said that he can't comment on disciplinary actions involving students. He says that the district "adheres to regulations established by the Texas Education Agency."

"I have confidence that our administration always addresses the Texas education code appropriately," he said.

In his statement Tuesday to parents and the community, Joffre said he understands they have "many questions and concerns." At a news conference Tuesday afternoon at a church that lasted less than five minutes, Joffre said he'd like to help "possibly address some of the concerns" about "conversations and speculation regarding student discipline."

The Associated Press contributed to this report.