It was dawn in the cellblocks of Dannemora, time for a round of bed checks on the convicted killers, rapists and other criminals held behind stark 19th-century walls. Guards went along the lattice of light-green bars in "A'' Block, where well-behaved prisoners are held.

At first glance, it seemed David Sweat and Richard Matt were where they were supposed to be: asleep in their adjoining cells. But the lumps in their bunks were just sweatshirts. The convicted cop killer and the career criminal doing time for dismembering his boss had squeezed through holes neatly cut in the steel wall behind their beds, penetrated a brick wall and a steam pipe, and emerged from a manhole outside the Clinton Correctional Facility's 40-foot wall.

"Have a nice day!" they smirked in a note left along the way.

It would be the last authorities would hear from them for three weeks, until officers found and killed Matt on Friday in woods near the Canadian border, about 30 miles from the prison, and captured Sweat nearby Sunday.

The June 6 escape spotlighted apparent security lapses in a prison where a complex escape plan may have been rehearsed for weeks and the breakout went undetected for as long as six hours.

But it also bared a culture of surprising liberties and personal relationships in a maximum-security prison where two convicted murderers — one with a history of escaping — were in privileged "honor" housing. A guard acknowledged giving one of them tools and access to an off-limits area in exchange for not only prison intel, but also paintings. And an instructor stands accused of helping the two escape after hatching a plot to kill her husband.

"What's extraordinary is: This is not how you should run prisons," says Terry Pelz, a former Texas prison warden who now teaches criminal justice at the University of Houston. While New York officials investigate what went wrong, at prisons nationwide, "you can rest assured that everybody's looking at their own procedures and reminding officers of what their job is."

___

If it was stunning that Matt and Sweat got out of one of the state's highest-security prisons, it was no surprise that they were in it.

Sweat, 34, had been in and out of prison since age 17. Growing up across the state in Binghamton, he'd had a childhood of behavioral problems, foster care and group homes.

On July 4, 2002, Sweat and a cousin were moving stolen guns from a stolen pickup truck to their car when Broome County Sheriff's Deputy Kevin Tarsia came across them in a Binghamton-area park. They shot him 15 times and ran him over, authorities said. Caught in the woods five days after the shooting, Sweat pleaded guilty and was sentenced to life in prison.

Matt's record of crime and flight goes back to 1986, when he was convicted of possessing a forged document and escaped from a jail in Buffalo. After his capture came more convictions, prison stints and parole violations.

He had been free for fewer than eight months when in 1997 he kidnapped, tortured and killed a Buffalo-area food broker a few weeks after being fired from a warehouse job, authorities said. He kept 76-year-old William Rickerson in a car trunk for 27 hours, broke the man's fingers, snapped his neck with bare hands and cut up his body with a hacksaw, according to trial testimony. Matt blamed a co-defendant.

He dodged arrest by fleeing to Mexico, where he soon killed a man outside a bar in the border town of Matamoros, authorities said. After nine years behind bars in Mexico, he was returned to New York, convicted of killing Rickerson and sentenced to 25 years to life.

A photo of Matt in his early 20s is at once flirtatious and challenging, a cigarette dangling rebelliously from his mouth and a taunting glint in his deep-set eyes, a confident expression that lingers in his most recent prison mug shot. Besides compelling looks, Matt had the magnetism of "a fun but dangerous guy to hang around with," Matthew Pynn, one of his lawyers, once said.

Those qualities, perhaps, help explain the escape in Dannemora.

___

While Matt and Sweat counted their final hours to freedom, prison tailor-shop instructor Joyce Mitchell was heading to a hospital with chest pains driven by a panic attack.

She was leaving the hospital when she learned that Matt and Sweat were on the loose and that state police were looking for her and her husband, Lyle, a fellow industrial instructor at the prison.

"They really escaped," she gasped, as he recalled it. She seemed shocked, but her husband didn't yet fully understand why.

She had worked at least five years in a $57,700-a-year job overseeing Matt, Sweat and other inmates in the tailor shop. At 51, she had a seemingly stable life: a 14-year marriage, adult children, even three terms as tax collector in her town near Dannemora. A full-figured blonde, she had a giddy side, but was "not somebody who's off the wall," as neighbor Sharon Currier described her.

Yet Mitchell had slipped chisels, a screwdriver bit and hacksaw blades to Matt and Sweat, with the blades concealed in frozen hamburger meat, according to prosecutors. She discussed having the murderers kill her husband and agreed to be their getaway driver but got cold feet, a prosecutor said. Mitchell has pleaded not guilty to prison-contraband and criminal facilitation charges.

"How can it happen?" Lyle Mitchell asked his wife while driving home from a police barracks days before her arrest, he later told NBC's "Today" show.

She explained she'd been unsure of his love and flattered by attention from Matt, who had tried to kiss her a few times, Lyle Mitchell said. But he said her fondness turned into fear when she told Matt she'd changed her mind about being their driver and he threatened to have her husband killed.

"I got over my head, and I was scared," she said, according to her husband.

___

Even by prison standards, 170-year-old Clinton Correctional is a hard place.

It's called "Little Siberia" because of its isolated setting with an average of 155 sub-freezing days a year. Almost 90 percent of the nearly 3,000 inmates have been convicted of at least one violent felony, compared with 63 percent statewide. A nonprofit prison inspection group report last year depicted a cauldron of violence, with guards beating inmates and prisoners fighting one another.

Yet it is also a prison where good behavior can get an inmate his own tiny plot of land to garden and barbecue on — and a cell on the "honor block," where Matt and Sweat had spent about the past five years.

They had access to a kitchen where they could cook their own meals — when not using jerry-rigged hot plates in their cells — plus more out-of-cell time than average and what were considered prime jobs in the tailor shop because of their exposure to staffers, former inmates say. The job, they say, entailed moving through the facility with a guard as escort.

"Everybody's got their hustle in prison, and sometimes that includes getting things from your work and selling it in the yard," said Ricky Jones, who was in Clinton on a 14-year manslaughter conviction. "You can get some creature comforts that way, but for the real high-end stuff, you need cooperation from the guards."

Matt and Sweat got cooperation that crossed the line into crime from veteran correction officer Gene Palmer, prosecutors said.

After 27 years, Palmer's $72,600-a-year job is so ingrained in his life that he plays in a local rock band called Just Us — apparently a play on the word justice.

The day of the breakout, Palmer told a neighbor to lock her doors, warning that the escapees were bad men. Yet he had developed so close a rapport with them that Matt gave him paintings and information on inmate wrongdoing.

Palmer, in turn, gave Matt art supplies, then pliers, a screwdriver and another questionable favor: access to a catwalk where Sweat said he would adjust electrical boxes to enhance inmates' cooking in their cells, Palmer said. The catwalk would later be part of the escape route.

Finally, on May 30, Palmer brought Mitchell's blade-laden ground beef to Matt, unaware, the 57-year-old guard said, of the hidden hacksaw parts. He plans to plead not guilty to prison contraband and other charges.

"I did not realize at the time," he said, what they had in mind.

At any prison, workers have to balance gaining inmates' cooperation with maintaining security. A minor kindness, such as allowing an extra shower, can both build trust and open doors that manipulative prisoners may try to exploit.

And so the two made their break.

___

As days stretched into weeks, searchers in the remote North Woods deployed bloodhounds and helicopters, checked houses and car trunks, and slogged through swamps and thick underbrush. Some schools even closed for a time.

On Friday, June 26, they were combing their latest hotspot, the forests around Malone, just a few miles from the Canadian border. It had been raining on and off for days, and the dampness made the seasonally cool nights feel downright cold.

It was the 21st day of a grueling manhunt that had involved as many as 800 officers at a time. Authorities checked out more than 2,400 leads that hopscotched from northern to southern New York, to Vermont and Philadelphia, where a cab driver mistakenly thought he had picked up the two men.

Forest, dirt roads and occasional cellphone towers constitute the landscape around Malone. Hunting cabins pepper the woods, most secluded and set far back from the road. It's mostly correctional officers who live there full time, joined seasonally by hunters. Old and lushly overgrown rail beds, now largely used as snowmobile trails, crisscross the land, alluring rights of way for two fugitives.

Residents of Malone, population 14,000, were told to lock doors, not a common practice in this town.

The past few days had turned up tantalizing clues: a broken-into cabin with evidence of Matt's presence, candy wrappers at a camp where someone had apparently lain down, an opened bottle of grape-flavored gin at an empty hunting cabin. Pepper shakers at one camp revealed Sweat's DNA, leading authorities to believe the escapees might have used the spice to mask the scent of their trail, apparently successfully.

Then, a driver towing a camper heard a loud noise and thought a tire had blown. Eight miles down the road, the driver found a bullet hole in the trailer.

A tactical team raced to the scene of the shot, smelled gunpowder in a nearby cabin and saw evidence that someone had fled out the back door.

A flash of movement and a noise, possibly a cough, did Matt in. A command to raise his hands went unheeded. He never got a chance to fire his 20-gauge shotgun before three bullets to the head killed him, authorities said.

A coroner said Matt was clean, well-fed and dressed for the elements. Bites from the summer bugs that pester human visitors seemed largely absent.

With no clear fix on Sweat, the manhunt moved on.

___

On Sunday, Day 23, the manhunt was the talk of Malone.

At a diner on Route 11, townspeople voiced support for the invasion of law enforcers, and a sign at a fast-food restaurant thanked them. Other places offered free meals to police. The window of the Dunkin' Donuts displayed a wanted poster with photos of Matt and Sweat.

Around 3:20 p.m., state police Sgt. Jay Cook was alone when he spotted Sweat walking down a road in the town of Constable, about 1½ miles from the Canadian border. Sweat cut toward a line of trees and refused commands to stop, authorities said.

Cook took aim and hit Sweat twice in the torso.

A photo captured him wearing a hooded parka and camouflage pants, smears of blood on his face. As authorities carried him away to a hospital in Malone, he coughed up blood.

"I can only assume," state police Superintendent Joseph D'Amico said, "he was going for the border."

When authorities interview Sweat, they might hear more details about how he and his fellow inmate pulled off an escape that will undoubtedly become legend.

For now, police and residents are just glad it's over.

"I feel like I can sleep tonight," Cathy Leffler said outside the hospital where Sweat was taken. "Life can go back to normal."

___

Contributing to this report were Associated Press writers Jake Pearson and David B. Caruso in New York and Michael Balsamo in Malone.