The attacker who killed three students and three staff members at a US school legally bought seven guns in recent years and hid them from their parents before carrying out the attack by firing indiscriminately at victims and spraying gunfire through doors and windows, police said on Tuesday.

The violence on Monday at the Covenant School is the latest school shooting to shock the United States.

Three nine-year-old students were killed, as well as the head of the grade school, a custodian and a substitute teacher.

The suspect, Audrey Hale, 28, was a former student at the school. Police said the shooter did not target specific victims.

Authorities said Hale was not on their radar before the attack. Police say Hale was under a doctor’s care for an undisclosed emotional disorder.

Police have released videos of the shooting, including edited surveillance footage that shows the shooter’s car driving up to the school, glass doors being shot out and the shooter ducking through one of them.

Additional video, from officer Rex Engelbert’s bodycam, shows a woman greeting police outside as they arrive at the Covenant School on Monday. “The kids are all locked down, but we have two kids that we don’t know where they are,” she tells police.

“OK, yes, ma’am,” Officer Engelbert replies.

Nashville-School Shooting
Police officers move into the school in this image provided by Metropolitan Nashville police department from bodycam footage (Metropolitan Nashville Police Department via AP)

The woman then directs officers to Fellowship Hall and says people inside had just heard gunshots. “Upstairs are a bunch of kids,” she says.

Three officers, including Officer Engelbert, search rooms one by one, holding rifles. “Metro Police,” officers yell.

“Let’s go, let’s go,” one officer yells.

As alarms are heard going off in the school, one officer says, “It sounds like it’s upstairs.”

Nashville-School Shooting
Police officers respond to the report of an active shooter at the school in Nashville (Metropolitan Nashville Police Department via AP)

Officers climb stairs to the second floor and enter a lobby area. “Move in,” an officer yells. Then a barrage of gunfire is heard.

“Get your hands away from the gun,” an officer yells twice. Then the shooter is shown motionless on the floor.

Police earlier said Hale had drawn a detailed map of the school, including potential entry points, and conducted surveillance of the building before carrying out the massacre, authorities said.

Police response times to school shootings have come under greater scrutiny after the elementary school massacre in Uvalde, Texas, in which 70 minutes passed before law enforcement stormed the classroom.

Nashville-School Shooting
Bodycam footage taken from the camera of Officer Rex Engelbert (Metropolitan Nashville Police Department via AP)

In Nashville, police have said 14 minutes passed from the initial call about a shooter in the school to when the suspect was killed, but they have not said how long it took them to arrive.

Surveillance video of the Covenant School grounds released by police shows a time stamp of just before 10.11am, when the glass doors were shot out by the shooter.

Police said they received a call about a shooter at 10.13am but have not said precisely what time they arrived, and the edited bodycam footage didn’t include time stamps.

A police spokesperson did not immediately respond to an email on Tuesday asking when they arrived or whether any version of the video includes time stamps.

Nashville School Shooting
A woman and a child bring flowers to lay at the entry to Covenant School in Nashville (AP Photo/John Amis)

Police have given unclear information on Hale’s gender. For hours on Monday, police identified the attacker as a woman.

At a late afternoon press conference, the police chief said Hale was transgender. After the news conference, police spokesperson Don Aaron declined to elaborate on how Hale identified.

In an email on Tuesday, police spokesperson Kristin Mumford said Hale “was assigned female at birth. Hale did use male pronouns on a social media profile”.

The victims were: children Evelyn Dieckhaus, Hallie Scruggs and William Kinney, all age nine. The adults were: Cynthia Peak, 61; Katherine Koonce, 60; and Mike Hill, 61.

Nashville School Shooting
A group of girls leave after a prayer vigil at Woodmont Christian Church for victims of the shooting (Mark Zaleski/The Tennessean via AP)

The website of the Covenant School, a Presbyterian school founded in 2001, lists a Katherine Koonce as the head of the school.

Her LinkedIn profile says she has led the school since July 2016. Ms Peak was a substitute teacher, and Mr Hill was a custodian, according to investigators.

Metropolitan Nashville Police Chief John Drake did not say exactly what drove Hale but said in an interview with NBC News that investigators believe the shooter had “some resentment for having to go to that school”.

Drake provided chilling examples of the assailant’s elaborate planning for the targeted attack, the latest in a series of mass shootings in a country that has grown increasingly unnerved by bloodshed in schools.

“We have a manifesto, we have some writings that we’re going over that pertain to this date, the actual incident,” he told reporters. “We have a map drawn out of how this was all going to take place.”

Authorities said Hale was armed with two “assault-style” weapons, as well as a handgun. At least two of them were believed to have been obtained legally in the Nashville area, according to the chief.

Police said a search of Hale’s home turned up a sawed-off shotgun, a second shotgun and other unspecified evidence.

President Joe Biden said he had spoken to the Nashville chief of police, mayor and senators in Tennessee. He pleaded with Congress to pass stronger gun safety laws, including a ban on assault weapons.

“The Congress has to act,” Biden said. The majority of the American people think having assault weapons is bizarre, it’s a crazy idea. They’re against that.”