Malone, New York (CNN) After a massive, more-than-three-week manhunt for David Sweat, the escaped murderer is back where he started -- in custody.

Authorities said a New York State Police sergeant -- identified as Jay Cook -- spotted Sweat, and after Sweat ran, the sergeant gave chase.

"At some point, running across a field, he realized that Sweat was going to make it to a tree line, and possibly could have disappeared, and he fired two shots," New York State Police Superintendent Joseph A. D'Amico told reporters.

Sweat, who was unarmed, was hit twice in the torso.

A photo exclusively obtained by CNN shows Sweat in custody moments after his capture. He appears bloodied and was wearing a camouflage outfit, not prison garb.

He was taken into custody in the town of Constable, in upstate New York, very close to the Canadian border.

CNN exclusive photo: David Sweat during his capture.

"I can only assume he was going for the border, that he was that close," D'Amico said.

Sweat was captured about 16 miles north of the location where fellow escapee Richard Matt was killed last week. The officer was alone when he shot Sweat.

Sweat was transported to the Alice Hyde Medical Center in Malone, an officer at the hospital told CNN. He was later moved to Albany Medical Center, where he was listed in critical condition, according to Dennis McKenna, medical director there.

Emergency, trauma, intensive care, radiology and vascular surgery specialists are involved in his care, McKenna said.

No law enforcement officers were injured during Sweat's apprehension.

"The nightmare is finally over," said New York Gov. Andrew Cuomo. "We wish it didn't happen in the first place. But if you have to have it happen, this is how you want it to end."

David Sweat was shot on the right side of this barn about two miles south of the Canadian border. #CNN #AC360 pic.twitter.com/zZ0LaVAqWg — Gary Tuchman (@GaryTuchmanCNN) June 28, 2015

The break

The arrest wraps up the statewide search for Sweat and his prison-break partner, Matt. Matt was shot dead Friday

Sweat was imprisoned at the Clinton Correctional Facility for shooting dead an officer who pursued him after a robbery he committed.

Behind bars, Sweat and Matt cozied up to a prison tailor and a guard who allegedly brought them tools , which they used to cut their way through a labyrinth of multiple barriers and underground passageways. They emerged to freedom through a manhole in the middle of a street.

Guards discovered them missing on June 6, during a routine bed check.

Law enforcement experts stressed Sunday that it's crucial Sweat survive so that officials can learn exactly how he and Matt escaped, and who helped them.

"Now that we have Mr. Sweat, it gives us the opportunity to have some more questions and provide more facts on the overall situation," Cuomo said. "Anyone who we find who was culpable and guilty of cooperating in the escape will be fully prosecuted."

D'Amico told reporters that investigators haven't yet interviewed Sweat, but that they hope to soon.

Investigators have questioned guards at the Clinton Correctional Facility about what conversations they had with the escapees about life outside the prison, according to a law enforcement official.

They believe Sweat and Matt were gathering information for almost a year about hunting cabins and the fields around the prison to help them navigate the terrain.

It's believed their conversations with the guards might have given the escapees some knowledge of how to get around, the official said.

The search

Earlier Sunday, about 1,300 federal, state and local law enforcement officers were searching vehicles at roadblocks and scouring dense woods in upstate New York for Sweat.

Since he and Matt broke out of the maximum security prison in Dannemora together -- and appeared to stick together on their flight from the law -- authorities were hopeful they could be right on Sweat's heels after encountering Matt.

Searchers had at times followed two sets of footprints, but when they gunned Matt down one day after his 49th birthday, there was no sign of Sweat nearby.

So, on all-terrain vehicles and in helicopters, they continued looking for the man who eluded them for three weeks, using infrared vision devices to peer through the night.

D'Amico admitted that authorities had a hard time tracking the fugitives and offered a possible explanation: pepper.

"We believe that possibly these two males were using pepper to throw the scent off of the dogs that were tracking them," he said.

The search Sunday was focused on an area along New York's State Route 30 between County Route 41 in the town of Malone and County Route 26 in the town of Duane.

'Thank God!'

Audra Buchanan of Constable said she was stunned to hear recently that Sweat could be near her home.

"We were so nervous," she said. "We've had our housed locked down."

When she saw on CNN that Sweat had been shot and was in custody, she said she felt "an incredible sigh of relief."

When she heard sirens and saw ambulances fly by her home, she thought, "Oh my God, thank God!" she told CNN's Suzanne Malveaux.

Her 9-year-old daughter has been begging to go outside and play for weeks, and Buchanan said she's glad she can now let her.

Sweat's mother described a similar feeling of relief. Pamela Sweat spoke to Time Warner Cable News after her son was captured.

"We started crying because (he) wasn't killed," she said.