CONSTABLE, N.Y. — David Sweat, the remaining prison escapee on the run in northern New York, was shot by a state trooper and taken into custody on Sunday after a 23-day manhunt that began with an improbable escape from two maximum-security cells and ended in the rain-drenched woods just south of the Canadian border.

Mr. Sweat, 35, a murderer who had been serving a sentence of life without parole, was in critical condition at Albany Medical Center late Sunday night, according to Dennis P. McKenna, the hospital’s medical director.

The shooting occurred here around 3:20 p.m. after a State Police sergeant spotted a man jogging down a road, stopped to question him and recognized him as Mr. Sweat, said Superintendent Joseph A. D’Amico of the New York State Police. The sergeant, Jay Cook, told Mr. Sweat to come over to him, but instead Mr. Sweat turned and fled across a field toward the tree line, Mr. D’Amico said. Sergeant Cook, a firearms instructor who was patrolling by himself, gave chase and finally opened fire, striking Mr. Sweat twice in the torso, because he realized the fugitive was going to make it to the woods and possibly disappear, Mr. D’Amico said.

More than 1,300 officers in rain-slicked gear had helped to tighten a cordon around Mr. Sweat on Sunday as the search, which had at times appeared to lurch between small New York towns as officials chased shreds of reported sightings, focused in on 22 square miles of rugged terrain. The confrontation with Mr. Sweat took place two days after his partner in flight from the authorities, Richard W. Matt, was shot and killed by a federal agent in the woods of Malone, N.Y.