WINSLOW – A five-hour armed standoff with local and state police ended Thursday with no injuries and a man in custody.

William M. Dolley, 39, of 167 North Pond Road was arrested outside his mobile home on a charge of terrorizing after threatening to shoot police, they said.

North Pond Road was cordoned off for much of the day as about 20 state police surrounded the home. Dolley eventually gave himself up after walking outside late Thursday afternoon, police said.

“I thought it went very well — the cooperation between Winslow police and state police,” said Winslow Police Chief Jeffrey Fenlason. “We worked together and it came out the way we wanted to — without incident and nobody was hurt.”

Fenlason said Dolley and his wife reportedly had a heated argument Wednesday night and sometime during the morning Dolley demanded his wife leave. She did, taking their two small daughters, and then calling police, Fenlason said.

“He called her on a cellphone — somehow he found out the police had been called; I don’t know if she told him directly — and he said, ‘You made a very big mistake by getting the police involved.’ He said, ‘I see anyone here, I’m going to shoot them, cops included,’” Fenlason said. “He said he would kill the first officer — any officer — he saw.”

Winslow officers arrived about 10:30 a.m., evacuated neighbors from their homes, and notified Maine State Police eight minutes later. A state police tactical team arrived, wearing camouflage and armed with assault rifles, a tracking dog and a crisis negotiator.

Dolley at some point during the morning fired a single shot, Fenlason said, though it wasn’t clear later what gun he used or where the shot was fired.

At one point, Dolley walked out the front door and gave the tactical team two middle fingers and went back inside, “so they became more concerned he was going to go for a weapon.”

Just before 3 p.m., Dolley walked out his back door and headed toward the woods, where he had a tent set up among trails.

State police followed him and repeatedly shouted at him to stop. Dolley, who was not armed, finally gave up, though he was still angry and maintained to police that he didn’t do anything, Fenlason said.