U.S. Attorney Rod Rosenstein arrives at a press conference Wednesday to announce that more than 50 correctional officers and inmates have been charged in a widespread bribery and drug conspiracy inside Maryland’s largest state prison. (Bill O'Leary/The Washington Post)

Prosecutors charged more than 50 correctional officers and inmates Wednesday in a widespread bribery and drug conspiracy inside Maryland’s largest state prison.

Prison guards are accused of smuggling cellphones, tobacco and drugs into the Eastern Shore facility in exchange for money and sex, according to the indictments unsealed in a federal investigation of the state’s long-troubled system.

The arrests on Wednesday were the culmination of a three-year investigation that revealed what authorities said was a culture of corruption at the 3,300-inmate medium-security Eastern Correctional Institution.

Prison guards passed through security and handed off heroin, cocaine and pornographic videos to inmates in exchange for thousands of dollars, prosecutors alleged.

The guards also are accused of warning inmates when prison officials were preparing to search cells for contraband and of using violence to retaliate against inmates who reported the smuggling to prison administrators.

The 18 guards “abused their positions of trust as sworn officers,” according to one of the two indictments unsealed in U.S. District Court in Baltimore on Wednesday. “This criminal conduct created a culture of corruption and lawlessness and perverted the intended purposes” of the prison.

At a news conference, U.S. Attorney Rod J. Rosenstein cited two stabbings of inmates who he said were set up by correctional officers who facilitated the attacks.

“Pervasive corruption leads to the break down in the legitimate operations of the institution,” Rosenstein said.

The investigation began in late 2013 with a tip from a correctional officer to the warden, according to Stephen T. Moyer, secretary of the state Department of Public Safety and Correctional Services. The case was initially handled locally but quickly grew in scope and was turned over to federal prosecutors, who worked with state prison internal affairs detectives.

Through recorded phone conversations, investigators learned inmates were directing the highly lucrative operation from the inside. According to court records, they used the prison phone system and illegal cellphones to place orders and make direct payments to correctional officers through the online payment system PayPal.

The “going rate” paid to guards was $500 for each package or as much as $3,000 a week, prosecutors contend.

In turn, inmates could sell the drugs to other inmates at a significant markup — $50 for the prescription opioid Suboxone, for example, compared with the $3 street price, according to the court filings, which also said one inmate said he hoped to make $50,000 before he was released.

The union representing prison guards said Wednesday that “no one wants correctional officers to be honest more than fellow correctional officers, who depend on their co-workers to have their backs.”

The statement from AFSCME also said the state system is understaffed by hundreds of officers and “needs men and women of the highest integrity to perform these dangerous jobs.”

The charges against a total of 80 defendants, including people outside the prison who helped in the alleged scheme, are the latest in a series of investigations to reveal problems inside Maryland prisons.

Three years ago, more than two dozen state correctional officers at the Baltimore City Detention Center and the Baltimore Central Booking and Intake Center were indicted over allegations that they helped leaders of a dangerous national gang operate a drug-trafficking and money-laundering scheme from behind bars.

In the 2013 case, an investigation uncovered smuggling operations and personal relationships between guards and inmates, including the shocking revelation about a gang leader who impregnated four guards.

Forty of 44 defendants in that case have been convicted, including 24 correctional officers. The Black Guerilla Family (BGF) gang leader, Tavon White, pleaded guilty to participating in the conspiracy and was sentenced to 12 years in prison.

The 2013 indictments put pressure on the administration of former governor Martin O’Malley and led to changes in leadership at the Baltimore detention center, tougher screening procedures for employees and inmates, and the creation of an anti-corruption investigation team.

On Wednesday, Maryland Gov. Larry Hogan took credit for making good on a campaign promise to combat corruption in the prison system.

“I hired Secretary Stephen Moyer with the directive to aggressively root out corruption in our state correctional facilities, and that is exactly what he has done,” Hogan said in a statement, noting the closure of one of the Baltimore facilities. “Our administration has been and will remain steadfastly committed to stopping this kind of illicit criminal behavior.”

There are about 7,000 correctional officers and 21,000 inmates in Maryland, according to Moyer, who said he agreed with the union that the corrections division is understaffed by 600 to 700 officers.

Moyer, a former Maryland state trooper, said one reason for the shortage is a recent requirement for new hires and those being promoted to undergo a polygraph test.

Unlike the Baltimore case, no single gang ran the smuggling operation that spanned the two compounds on 620 acres in Somerset County. Prosecutors said correctional officers became middlemen between inmates and their outside contacts, who provided the illegal cellphones and drugs.

The guards — men and women primarily hired in the past 10 years — hid contraband in their hair and underwear when they passed through security, prosecutors said. Inside, guards delivered packages to prearranged “stash” locations in bathrooms and storage closets or in the officers’ dining room, where guards could interact with inmates who worked as servers and kitchen staff.

In November 2015, court filings say, the inmate who hoped to build a $50,000 nest egg through the scheme, told a correctional officer, “I just passed out a pack today. So 1400 is owed to us. . . . We need more,” he wrote in reference to the tobacco sales.

Three days later, the inmate texted again, the indictment states.

“I want at least 50,000 leaving this place. I know I can get it.”

Some inmates traded sex with prison guards in exchange for the contraband, and “these sexual relationships cemented the smuggling and trafficking relationships,” prosecutors said.

The correctional officers, inmates and outside facilitators face a long list of charges in the racketeering and drug conspiracy and could face maximum sentences of 20 years in prison.

As Rosenstein spoke Wednesday, he was flanked by placards highlighting excerpts from recorded phone conversations that suggest the message from law enforcement in cases like this one and the previous investigation of the Baltimore jail known as BCDC may be getting through.

In an intercepted call in May 2016, a former correctional officer warned a contact: “Did you see on the news what happened down BCDC out here?

“It was a BGF dude, he was pretty much doing the same thing, the whole time like somebody was listening on the conversation.”