Police in Maryland on Thursday took into custody a man they believe shot two detectives, ending a 15-hour manhunt that forced some schools to close and locked down suburban waterfront communities in eastern Anne Arundel County.

The all-clear came in a tweet after 3 p.m. when county police told residents that they “do not believe there is any further threat to our community.” Authorities had urged residents in Riviera Beach, Stoney Beach and Orchard Beach to stay indoors as heavily armed officers searched door-do-door.

As of Thursday afternoon, police had not provided additional details of how the person was taken into custody or whether he or his relatives had heard Anne Arundel Police Chief Timothy J. Alto­mare’s public plea that the gunman surrender and “end this lunacy before another person gets hurt.”

The county officers were wounded in separate locations miles apart while police were conducting a homicide investigation involving a man found dead inside a home about 5 p.m. Wednesday in Glen Burnie, south of Baltimore.

Police said that the person found dead had suffered at least one gunshot wound to the upper body and that his vehicle was missing. Police said detectives spotted that vehicle about 11 p.m. Wednesday near a Royal Farms store in South Baltimore, on the border with Anne Arundel County.

Altomare said the officers “attempted a traffic stop” when the person in the vehicle fired a gun, striking one of the detectives. He was able to pull over and call for help. Another officer pursued the vehicle south for more than five miles, into the central county community of Pasadena and then into Riviera Beach, along the Chesapeake Bay. There, police said, the man ran from the vehicle and shot a second detective.

One of the wounded officers was described as a 22-year veteran assigned to a fugitive apprehension squad. The other has been on the force 13 years and is on a homeland-security team that investigates criminal gangs.

Altomare did not say which officer was shot at each location, but he said the officer wounded near the convenience store was initially in life-threatening condition. He credited doctors, saying “fantastic care mitigated the potential threat” to his life.

Both officers are expected to survive.

At a news conference Wednesday morning, as the search continued, the chief had only a scant description of a potential suspect and said police had learned few details of the apparent homicide and of the man they were seeking. He described the investigation as lurching “in fits and starts through the night” with leads that appeared promising fizzling out.

At that earlier news conference, Altomare said schools in the northeastern area of the county, which stretches from Baltimore to south of Annapolis, closed to keep as few people on public streets as possible. He also urged residents in that area to shutter indoors.

Police in tactical gear and carrying assault-style weapons were seen searching buildings and going from house to house. Altomare said as many as 50 officers were involved in the search.

Altomare had urged the man to surrender, saying that being on the run made it more dangerous for “my cops, and thus it makes it more dangerous for you.” He added, “You need to come in and end this lunacy before another person gets hurt.”

On Twitter, Maryland Gov. Larry Hogan (R) condemned the violence. “We have absolutely no tolerance for the violence committed against two Anne Arundel County Police detectives last night,” Hogan said. “These brave officers are now in stable condition, and all Marylanders are praying for their full and speedy recovery.”

Clarence Williams contributed to this report.