DALLAS (AP) _ A police standoff ended after nine hours Wednesday with a gunman and two other people dead and four officers wounded. Eight hostages, a woman and seven children, were safely released.

SWAT team officers shot and killed Francisco Fuentes, 32, a resident of the apartment who had held them at bay much of the day and fired at officers two separate times.

Police found two other men dead in the apartment, apparently shot by Fuentes before police arrived earlier in the day to investigate reports of gunfire, spokesman Sgt. Gil Cerda said. Their names were not released.

Police hadn't determined the motive in the hostage-taking and killings and were questioning the woman who had been held hostage, Cerda said.

Neighbor Darrell Davis said he was awakened by gunfire, and then police told residents to ```get out, get out now!'''

``When they found the gunman in there, there were about three shots from a big gun and we all ran for cover,'' he said.

When police were first summoned to the Meadow Parc Apartments, the children in the apartment told them that Fuentes was inside a bedroom with a gun. Fuentes wounded three officers when they entered the bedroom, Cerda said. The officers saw the body of at least one man on the floor, he said.

The officers retreated after they were wounded and four children were freed at that time.

Over the next few hours, Fuentes released the other three children and the woman he had been holding hostage, authorities said. The woman's relationship to the man was not immediately clear.

Eventually, police filled the apartment with tear gas in an attempt to end the standoff, then burst in to the apartment. They killed Fuentes when, for a second time, he fired at officers, Cerda said. That was when the fourth officer was wounded, he said.

All of the wounded officers were in good condition and their injuries are not life-threatening, authorities said.