When things got tough, the people of this Southside hamlet made a hard decision. They welcomed into their midst the Mecklenburg Correctional Center, a sallow-trimmed building filled with murderers and rapists that promised to pump jobs and revenue back into the ailing economy.

For three decades, that decision buoyed Boydton, a blue-collar community so proud of its scrappiness that U.S. News and World Report once called it: “A Small Town That Refuses to Die.”

But as the town prepared for its 200th anniversary in February, it was blindsided by news the state planned to shutter the prison, which houses about 730 inmates.

Boydton ultimately will lose 20 percent of its annual budget — revenue that comes from providing sewer services to the prison — and the area is poised to lose 300 jobs. Officials fear they will have to lay off most of the town’s workers, including its only police officer; triple some water rates; and cut back on trash pickups. More than $1.5 million in grants are in jeopardy. If the town does not get help from the state, it could go bankrupt and be dissolved.

Boydton’s bicentennial could turn into its wake.

“They call Boydton a little Mayberry – and that’s what it is,” said Alan Panther, who has lived in the town of about 480 all his life and works at the prison. “We were really trying to make a comeback. All that work is going to go down the drain.”

The story of Boydton is playing out in small towns across Virginia and around the nation. Many depressed rural communities welcomed prisons in recent decades as sources of jobs and revenue — The Post dubbed it “salvation through incarceration.”

But budget woes and moves to jail fewer nonviolent offenders are leading states to mothball dozens of correctional facilities — an unexpected blow for communities already suffering from the recession. In 2o10, the overall U.S. prison population declined for the first time in four decades to 1.6 million and at least 13 states closed prisons. Virginia alone has closed 10, in addition to Mecklenburg, since 2009.

Many in towns that saw factories go overseas and farms wither never imagined a prison could disappear too. The jobs were supposed to be recession proof. After all, it was government work and there was always more bad guys to lock up. They built their lives and communities around that belief.

Now they are watching their last economic lifelines go away and wondering: How will we survive?

‘You could hear a pin drop’

Two weeks before Christmas, word spread among the tightknit group of prison workers that there would be an emergency meeting. About 100 correctional officers and other employees filed into the prisoners’ visiting room the night of Dec. 12 with no idea what was to come.

“ ‘I’m going to cut right to the chase. Because of cutbacks we are closing the facility,’ ” Panther recalled a state corrections official announcing. “It was a shock. You could hear a pin drop in the room.”

The prison sits on a bluff, a short drive and a world away from Boydton’s picturesque downtown with its quaint storefronts and whitewashed, 1830s courthouse.

Opened in 1976, the prison is a collection of institutional brown buildings surrounded by razor wire. At one time, it housed death row and it was dubbed a “monument to failure.”

For Boydton, it was anything but that. The prison is now the fifth-largest employer in Mecklenburg and it pays Boydton $240,000 a year for sewage services. Guards eat lunch at the local watering hole, the Copper Kettle, and visitors stop by the Dollar General.

The prison’s importance to the town was cemented in the last decade as Mecklenburg saw the twin pillars of its economy crumble: manufacturing and tobacco. A Burlington Industries textile mill and Russell Stover Candy plant closed, leaving more than 3,500 out of work, and health concerns about cigarettes drove a long slide in tobacco farming.

Marilyn Boyd has found herself at the center of Mecklenburg’s declining fortunes. She worked at Burlington Industries for 15 years and was laid off when its mill closed in 2002. She had planned to retire there.

Boyd sought work at the prison because it seemed a safe harbor in a county that has one of Virginia’s highest unemployment rates — 8.8 percent. She had hoped to retire there, too.

But after 35 years of operation, Gov. Robert F. McDonnell announced the prison would close in May. Officials said Pennsylvania triggered the closure by deciding to remove about 1,000 prisoners housed under contract in Virginia.

Virginia prisoners will move to Chatham’s Green Rock prison, a newer facility where officials said they could be held more cheaply. But the future for workers is less certain.

McDonnell pledged to provide “as much assistance as possible” to employees. Officials said they will be able to place about half at prisons within commuting distance. The transfers will begin in February. Eligible workers can also take early retirement, while laid-off workers will get a severance package.

Boyd is banking on a transfer, but the prison’s imminent closure has left her with a sickly sense of familiarity. At 48, with Burlington gone and the prison going, she has few options.

“This is our second go-round with a closing, and Mecklenburg is our last big employer,” she said.

Refusing to die

Johnathan Kirkland is Boydton’s police chief — and its police force. Boydton is small enough, and safe enough, for a department of one. The biggest crime he has seen in his nine months on the job: a break-in at an old oil factory.

As he cruises around town, the 26-year-old knows every face and he chats with residents. He is the third generation of Kirklands to serve and protect in Mecklenburg. His father was a police officer in neighboring Chase City and his grandfather was a county sheriff’s deputy.

Kirkland took the job because he thought government work would be safe in these bad economic times. Now, he is looking at possibly being laid off.

Boydton is quiet, but what is a small town without its police chief? The idea strikes Kirkland as a bit troubling because his job goes well beyond writing tickets — he chaperones kids on Halloween, checks homes when people are away and more.

“You kind of wonder if some of the citizens realize there is no police officer around, what might happen,” Kirkland said.

Following Kirkland out the door could be the maintenance workers, assistant clerk, wastewater treatment plant workers and others — in all two-thirds of the town’s 10 employees could be let go.

Mayor Gerald Wrenn and Treasurer Shirley Bowen spend their time looking for a lifeline. They vow the town will not lose its charter. It is a matter of pride: They do not want the town to go away on their watch.

But each day, there’s a little less cash in the town’s coffers. As it prepares to close, the prison is producing less sewage and less revenue for Boydton. They said the town will have to fill a $60,000 to $120,000 hole in its $1.2 million budget this year. By next year, that deficit will double.

The town has asked the state for help filling those holes, which could give it some breathing room to deal with its budget woes.

Wrenn is confident that if the town can get past the current crisis it is poised to reinvent itself. Microsoft opened a cloud-computing data center in a local business park, the first stage of a three-part development.

A new marina project on nearby Buggs Island Lake and a planned horse park could lure visitors. But for now, the bad economy has slowed these latter projects. “These were the engines that would fuel our turnaround,” Wrenn said. “The town has to become a destination.”

With the same hope for recovery, Boydton residents continue to plan for its anniversary. They will ring every bell in town on Feb. 3 and honor its oldest residents. Boydton is determined not to be wiped off the map.

“What are we going to be celebrating, shutting the town down?” said Bowen, on a recent afternoon at Town Hall. She pointed to the U.S. News and World Report article, which is displayed prominently and has become the town’s rallying cry. “No, we’re refusing to die.”