Prison escapee David Sweat was shot and captured Sunday just south of the Canadian border, ending an statewide manhunt that spanned more than three weeks.

"Today ends with good news," Gov. Andrew Cuomo said. "These were very, very dangerous men. We could not tolerate them being on the loose."

An army of officers had been searching for Sweat, the surviving escaped killer, under steady rainfall keeping their focus on the dense and boggy woods of upstate New York where Richard Matt, his fellow fugitive, was shot three times in the head two days earlier.

Sweat's capture ends 23 days of an intensive search for the two convicted killers.

Sweat was trotting along a road in the town of Constable at about 3:20 p.m. when he was spotted by state police Sgt. Jay Cook, who was supervising a northern perimeter of the search, said State Police Superintendent Joesph D'Amico.

Cook got out of his patrol car and recognized Sweat, who fled on foot into a field. Cook gave chase, but was unable to catch him. As Sweat approached a wooded area, Cook opened fire, fearing the fugitive would vanish in the dense brush, D'Amico said.

Sweat was struck twice in the torso and was taken to a nearby hospital, but later transferred to Albany Medical Center, where a spokesman said Sunday night that Sweat was listed in critical condition. The spokesman declined to elaborate about Sweat's condition or treatment.

Cook was alone during the confrontation. Sweat was unarmed.

Earlier Sunday, state troopers with guns drawn searched a cabin in Malone and other officers carrying rifles manned checkpoints and examined vehicles, opening trunks and peering into windows in their hunt for Sweat.

Matt — who once vowed never to be taken alive — was fatally shot Friday during an encounter with border patrol agents about 30 miles west of the prison he escaped from with Sweat on June 6.

A coroner who examined Matt's body said he had been eating and drinking during his time on the run, was fittingly dressed for the outdoors and largely unassailed by the swarms of bugs present in the woods where he was shot and killed.

Franklin County Coroner Brian Langdon said Sunday that Matt was in good physical shape until his fatal confrontation with authorities. Matt was shot three times in the head by a member of a U.S. Customs and Border Protection Tactical Unit, according to a New York State Police press release.

The coroner said the results of toxicology reports are several weeks away.

Langdon said Matt's body was clean and he may have even showered and shaved in the time since his escape from the Clinton Correctional Facility on June 6.

On Sunday, about 1,200 searchers focused intensely on 22 square miles of thick forests and heavy brush around where Matt was killed. Police hoped Sweat would finally succumb to the stress of little sleep, scant food and biting bugs.

The manhunt broke open Friday afternoon when a person towing a camper heard a loud noise and thought a tire had blown. Finding there was no flat, the driver drove eight miles before looking again and finding a bullet hole in the trailer. A tactical team responding to the scene of the shot smelled gunpowder inside a cabin and saw evidence that someone had fled out the back door.

A noise — perhaps a cough — ultimately did Matt in. A border patrol team discovered Matt, who was shot after failing to heed a command to raise his hands.

Matt had a 20-gauge shotgun that was believed to have been taken from another cabin. The pair had apparently been relying on the remote region's many hunting camps and seasonal dwellings for supplies.

Matt, who turned 49 the day before he died, was serving 25 years to life at Clinton Correctional Facility for the killing and dismemberment of his former boss.

Sweat, 35, was serving a sentence of life without parole in the killing of a sheriff's deputy in Broome County in 2002. Mulverhill said investigators believe he may be armed.

Matt and Sweat used power tools to saw through a steel cell wall and several steel steam pipes, bashed a hole through a 2-foot-thick brick wall, squirmed through pipes and emerged from a manhole outside the prison. Two prison workers have been charged.

