AURORA, Colo. (Reuters) - A gunman who barricaded himself inside a townhouse after killing three people in the home was shot to death by police on Saturday in Aurora, Colorado, the same Denver suburb where 12 people were slain in a movie house massacre last July, police said.

The gunman and his three victims, as well as a woman who fled safely from the home at the outset of the violence and alerted authorities, were all believed to be related to one another, police spokeswoman Cassidee Carlson said.

But the motive for the killings was not immediately understood.

“We’re trying to find out what set this guy off,” she told Reuters.

A hostage-negotiation team called to the scene had sought to talk the suspect into surrendering for about five hours before police moved to shoot tear gas into the home at about 8:00 a.m. (10:00 a.m. EST/1500 GMT), prompting the gunman to open fire on officers from inside, police said.

About an hour later, the gunman began firing at police again from a second-floor window, and police returned fire, killing the suspect, according to a police statement following the incident. No police were wounded.

Officers entering the townhouse found the bodies of the gunman and three other people - two men and a woman - who were presumed to have been shot hours earlier before police were called to the scene.

Slideshow ( 11 images )

“None of the officers heard gunshots until they were directed at us at about 8 o’clock,” Carlson said. The woman who escaped the home also told police the victims were shot before she fled.

The names of the gunman and his three victims were being withheld until the coroner could confirm their identities and notify next of kin, authorities said.

The episode kept residents in much of the surrounding community awake overnight, as police notified neighbors of an emergency situation and evacuated several adjacent blocks.

One neighbor, Sunil Pawar, 59, said he received a reverse 911 call advising him to stay inside and away from windows before police later showed up to ring doorbells and escort residents of the townhouse development to safety.

Pawar said he opted to stay put, later hearing gunshots, followed by the voices of police calling to the gunman though a bullhorn, saying, “Sonny, we want to talk to you, pick up the phone, Sonny.”

Another neighbor, Michael Ignace, 46, said he had previously spoken with the man suspected of the shooting, and “he seemed like a reasonable guy, and we talked about motorcycles.”

The standoff and shooting unfolded just a few miles south of the Aurora movie theater where 12 people were killed and 58 others wounded when a lone gunman opened fire there in July during a midnight showing of the Batman film, “The Dark Knight Rises.”

The suspect in that rampage, former college student James Holmes, is due back in court on Monday for a hearing in which prosecutors will seek to convince a judge they have sufficient evidence to put him on trial.

The Colorado movie theater killings had ranked as deadliest mass shooting in the United States last year until a December 14 massacre at an elementary school in Newtown, Connecticut, where a gunman shot 20 school children and six adults to death before taking his own life. The shooter in that case also had killed his mother at their home.