A gunman walks into a school and starts shooting.

It's that rare, worst-case scenario, one that all police prepare for and every parent prays will never happen.

But if it happens at one Oakland charter school, a person 25 miles away, sitting in a small, dark room on the second floor of a building in a Newark business park, will hear the gunshots and - within seconds - push a button to notify police.

The information will hit police car computer screens instantly and include a floor plan of the school showing which classroom the shots were fired in, the type of gun used, and which direction the shooter or shooters appear to be moving. If more shots are fired, police almost instantly will know the exact location.

Classroom teachers and staff can also get instant messages advising them to lock down their rooms - or run.

The first-of-its-kind technology, announced Monday, brings gunshot detection systems - already used on the streets in Oakland, San Francisco and dozens of cities across the country - into schools.

Expensive protection

The Oakland charter school, which officials declined to identify, will be among the first in the country to use the new technology.

"The sad reality is that preparing for an active shooter is the new normal," said Ralph Clark, CEO and president of ShotSpotter, the company that makes and monitors the system. "We must ensure that we do everything within our power to provide an enhanced notification and response capability to first responders so that they can effectively engage determined mass killers who are willing to lose their lives and limit their ability to wreak havoc."

The warning system could indeed save lives. But it comes at a price.

For a $15,000 set-up fee and about $10,000 per year in fees, any school in the country can have the eyes and ears of a ShotSpotter employee at a bank of computer screens keeping tabs on classrooms.

It will be up to school districts, individual schools and perhaps PTAs to decide if they want to spend the money to shave seconds or minutes off police response time.

At the Oakland charter school, the service will be free, at least in the short term. Clark declined to identify the specific school until the details of the pilot program are completed, but an announcement and the installation are expected within the next few weeks.

A sensor about the size of a light switch will be placed in every room in the school, including open areas and hallways. The sensors are designed to detect the pressure changes and infrared heat associated with gunshots.

"It gets down to how we think about mitigating a risk," Clark said. "Although not frequent, when it does happen, minutes matter."

There are more than 140,000 K-12 schools and colleges across the country, and over the past five years, there have been 85 cases of school shooting, according to the Joint Regional Intelligence Center, a coalition of Southern California law enforcement agencies.

Tragedies like the deaths of 20 children and six adults in 2012 by a shooter at Sandy Hook Elementary School in Newtown, Conn., have created demand for better prevention efforts and stronger school security.

"These incidents are relatively rare," said Ann Harkins, president of the National Crime Prevention Council. "That makes them no less horrifying."

Tough sell for some

For-profit companies have jumped into the school safety market, including one, International Armoring Corp., that offers bulletproof shields made to look like whiteboards, shelves or other classroom objects.

School communities need to ask what they need to keep their children safe, Harkins said.

"Each school has to make decisions for itself," Harkins said. "What's important is that people are making these assessments."

Still, this new tool will be a tough sell to some school officials.

"It's not an investment that makes sense," said Jody London, an Oakland school board member, adding that it would be a huge expense to outfit the 90 district schools, given how rare school shootings are. "What is a problem are guns on the streets and kids not being able to get home safely."

Spending $1 million a year to listen for unlikely gunshots doesn't make sense, she said.

"My response to that is my response after Sandy Hook, I don't want my schools to be fortresses," London said, adding she'd rather spend the money on counselors. "At the end of the day, the person who has positive interactions with the students is ultimately going to be a better long-term deterrent."

Yet, even though 100 percent of school shootings are reported, the information is inaccurate or confusing. And there are delays - gunshots one room over can sound a lot like a door slamming or chair falling.

Quick information

For law enforcement, the more quickly first responders get accurate information, the better, Alameda County Sheriff Gregory Ahern said in a statement regarding Site Secure technology, which is the indoor product of ShotSpotter.

"Knowing information like the number of shooters, where the shots were actually fired, and the information of where the suspects currently may be, as well as the possible type of weapons being fired, is critical to how to respond quickly and put an end to the threat," he said.

ShotSpotter officials see a market for the indoor sensors in malls, college campuses, airports and on military bases as well.

But K-12 schools are their first focus.

Clark compares it to school fire alarms, which have smoke and heat detection systems and automatic notification to emergency responders.

"It might make sense for some schools to adopt a fire alarm for gunshots," he said. "Some percent of schools are going to want this capability."