One man and four children are dead after a standoff of more than 20 hours, Orlando police Chief John Mina said.

Mina said officers were in contact with Gary Lindsey Jr., directly and indirectly, by phone throughout the day Monday after he shot an officer around 11:45 p.m. Sunday and barricaded himself in an apartment with the four children, ages 1, 6, 10 and 11.

They had gone to the apartment in response to a domestic violence call from Lindsey’s girlfriend.

At one point, Mina said, officers tried to give Lindsey another phone because his WiFi phone had a bad connection, and during the exchange they saw that one of the children was dead.

Officers entered the apartment around 9 p.m. Monday, Mina said, and found the children dead of gunshot wounds in two bedrooms. Lindsey’s body was found in a closet with an apparent self-inflicted gunshot wound, police said.

Mina said two children are believed to be Lindsey’s and two are his girlfriend’s.

“We have no idea when those poor children lost their lives. That will all be part of the investigation,” Mina said. He added that law enforcement had worked all day to bring the standoff to a peaceful resolution, but unfortunately it was a “tragic and sad” ending.

Mina said Tuesday afternoon that there was never any indication of an imminent threat to the children during the standoff. Authorities continued to try to talk to the suspect, while SWAT team members studied the apartment layout.

Lindsey, 35, shot at officers when they arrived, hitting one, Mina said. At least one officer returned fire, but Mina said he did not know whether Lindsey was hit. Police said Lindsey’s girlfriend made the initial call after she had left the apartment.

Lindsey inherited the guns — two rifles, two shotguns and a handgun — from his father, Mina said.

Officer Kevin Valencia, who has been with the Orlando police since 2016, was shot. He is in critical condition after surgery, Mina said.

“It was around midnight and we were sleeping, and we heard somebody knocking on the door on the second floor,” Lopez told WKMG. “Suddenly somebody opened the door and we just hear, ‘Pow, pow, pow, pow’ — four gunshots.”

Taipa said she saw the wounded officer from their apartment window.

“We saw the police officer laying on the ground with blood and everything,” she said. “It was horrible.”

Police then told the couple it was not safe for them to stay in the building, Lopez said.