The second of two convicted murderers who escaped three weeks ago from a maximum-security prison in northern New York state was shot and captured near the Canadian border.
It came two days after his fellow inmate was killed in a confrontation with police.
"The nightmare is finally over," Governor Andrew Cuomo declared at a news conference.
A state police sergeant shot David Sweat in the town of Constable, just south of the Canadian border and 30 miles from the prison, after spotting him walking along a road and recognising him.
Sgt Jay Cook was alone and on routine patrol when he stumbled upon Sweat. He gave chase when Sweat fled and decided to fire as the fugitive approached a tree line where Cook feared he would lose him, state police said.
"I can only assume he was going for the border," Superintendent Joseph D'Amico said.
Sweat, who was unarmed, was struck twice in the torso and was taken to a hospital in stable condition.
He has not been formally interviewed by investigators, but any information he provides could be critical to the investigation, Clinton County chief prosecutor Andrew Wylie said.
Sweat will be charged with escape, burglary and other charges, Mr Wylie said.
The inmates are suspected of breaking into some of the region's many cabins during their time on the run. Prosecutors will wait for Sweat to recover before charging him.
His capture came two days after his escape partner, Richard Matt, was shot and killed by police. The men had been on the loose since June 6, when they cut their way out of prison using power tools.
Mr D'Amico said the men may have used black pepper to mask their trail, as Sweat's DNA was recovered from pepper shakers found at one camp where the fugitives may have spent time.
"We did have difficulty tracking so, you know, it was fairly effective in that respect," he said.
Mr Cuomo said many questions remained unanswered.
"We have already started a full investigation," he said. "But today ends with good news. These were dangerous, dangerous men."
Matt and Sweat used power tools to saw through a steel cell wall and several steel steam pipes, bashed a hole through a brick wall, squirmed through pipes and emerged from a manhole outside the Clinton Correctional Facility in Dannemora.
Sweat was serving a sentence of life without parole for killing a sheriff's deputy in 2002. Matt was serving 25 years to life for killing and dismembering his former boss. They were added to the US Marshals Service's 15 Most Wanted fugitives list two weeks after getting away.
The search for the escaped killers was initially concentrated around the prison and a rural community where dogs had caught the scent of both men.
It was then expanded to neighbouring counties, and, while authorities said there was no evidence the men had left the general area, they conceded they could have been almost anywhere.
There was a dramatic development on Friday afternoon when a person towing a camper heard a loud noise and thought a tyre had blown.
Finding there was no flat tyre, 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 for Matt. A border patrol team discovered him, and he was shot after failing to heed a command to raise his hands. He was shot three times in the head, according to a post-mortem.
A coroner who attended the post-mortem said Matt was clean, well-fed and dressed for the elements at the time he was killed.
Two prison workers have been charged in connection with the inmates' escape.
Prosecutors said Joyce Mitchell, a prison tailoring shop instructor who got close to the men while working with them, had agreed to be their getaway driver but backed out because she felt guilty for participating.
The authorities also said she had discussed killing her husband, Lyle Mitchell, as part of the plot.
Joyce Mitchell pleaded not guilty on June 15 to charges including promoting prison contraband, which authorities said included hacksaw blades and chisels.
The men had filled their beds in their adjacent cells with clothes to make it appear they were sleeping when guards made overnight rounds. On a cut steam pipe, the prisoners left a taunting note containing a crude caricature of a face and the words: "Have a nice day."
They apparently used tools stored by prison contractors, taking care to return them to their toolboxes after each night's work.
On Wednesday, the authorities charged Clinton correction officer Gene Palmer with promoting prison contraband, tampering with physical evidence and official misconduct.
Officials said he gave the two prisoners the frozen hamburger meat Joyce Mitchell had used to hide the tools she smuggled to Sweat and Matt.
Palmer's lawyer said he had no knowledge that the meat contained hacksaw blades, a bit and a screwdriver.