The man suspected of killing 18 people and injuring 13 others in a shooting at a bar and a bowling alley in Lewiston, Maine, on Wednesday night was found dead of an apparent self-inflicted gunshot wound Friday, according to officials briefed on the matter, ending a sweeping search that had forced thousands of residents throughout the region to remain in their homes.

The body of the man, Robert Card, 40, was found at a recycling center where he used to work, the officials said.

The hunt for Card had extended across much of a largely rural U.S. state with many potential hiding places, producing an atmosphere of high anxiety as helicopters whirred over farms and forests, police cruisers roared along rural roads and divers plunged into the chilly waters of the Androscoggin River.