(CNN)The suspect accused of shooting and killing a Tacoma, Washington, police officer was killed early Thursday after a standoff with authorities that lasted for hours, officials said.
A Pierce County sheriff's deputy shot the suspect, who had been using two children as a shield, Detective Ed Troyer said.
"We didn't want the kids to get hurt on top of everything that happened. Unfortunately, such a horrible situation, this could have ended a lot worse," Troyer told reporters. "The suspect's deceased. The kids are safe. That's really what we're very thankful for.
Officer responded to domestic dispute
Police said the officer, who has not yet been publicly identified, was responding to a domestic dispute Wednesday afternoon when the suspect shot him. He died Wednesday night.
The 45-year-old officer joined the department in 1999, Tacoma police Chief Donald Ramsdell said.
Once authorities learned the suspect was using children as a shield, they patiently tried to negotiate with him through the night.
"The negotiations failed," Troyer said. "We went in, took one of the kids when we had a chance, and he grabbed the other kid. One of our officers felt he had a shot. He took it."
Throughout the night, officers from different agencies acted heroically, he said.
"Everybody came together to help keep this neighborhood safe. It's a horrible beginning to this. ... The ending to this is equally as sad, but we still have two really safe kids, and no other neighbors and no other officers got hurt," Troyer said.