Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

CHARLESTON, S.C. — The only person with whom Dylann Roof shared his racist plot to massacre worshipers at a historically black South Carolina church was sentenced Tuesday to 27 months in prison for failing to report a crime and for lying to the FBI.

Joey Meek cried at sentencing Tuesday in Charleston by the same federal judge who presided over Roof's trial, which ended in January with Roof being sentenced to death for the slaughter of nine people at Emanuel AME church.

Joseph Meek, a friend of Dylann Roof, speaks to The Associated Press on June 18, 2015. APTN via AP

"I'm really, really sorry. A lot of beautiful lives were taken," said Meek, who began to cry at sentencing.

Meek had faced 27 to 33 months behind bars.

U.S. District Judge Richard Gergel said he hoped the sentence would serve as a deterrent for anyone in the future who learns of something so serious and fails to come forward to authorities. He added that Meek was fortunate another massacre didn't occur because of the delay in identifying Roof.

No family members of the victims spoke at sentencing.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Meek said Roof shared his plan to shoot blacks at the historic African-American church in Charleston during a night at Meek's house where they drank vodka, snorted cocaine, smoked marijuana and played video games. Authorities said that was about a week before the June 17, 2015, killings.

Meek signed a deal with prosecutors in 2016, agreeing to plead guilty to lying to authorities and failure to report a crime. Federal prosecutors said he had lied to the FBI by first denying Roof shared his plan. Authorities said he also had stopped a friend from calling police after hearing about the shooting to report Roof as a suspect.

Gergel previously ruled that Meek could only be sentenced for what he did after the slayings, not for any inaction beforehand. Meek's "failure to make an earlier report is tragic and deeply regrettable, but his failure to report was not a violation of federal criminal law," the judge had written earlier.

Meek also had agreed to help prosecutors as part of his 2016 deal. But they never called him during Roof's trial, in which Roof acted as his own lawyer for much of the proceedings and put up almost no defense.

Then just before Meek was initially set to be sentenced last month, prosecutors asked for a stiffer sentence than guidelines recommended, seeking to make an example of him and reflect the seriousness of the crime that Meek could have stopped if he'd picked up the phone.

Meek's lawyer, Deborah Barbier, said recently that that was unfair.

Related: Dylann Roof confesses to Charleston church shooting

She said Meek had sent handwritten letters to the families of each victim apologizing. She also said he thinks regularly of what happened and is pained.

Barbier also had said previously that the U.S. government shares the burden of not stopping Roof, by failing to finish a background check when he went to buy the gun used in the killings.

"This allegation ignores the Government's own failures in allowing Roof to buy and possess a handgun with pending drug charge," Barbier wrote previously in asking Gergel not to give Meek a longer sentence than the guidelines call for.

Meek also is a product of his times where "we live in a society where people say shocking and violent things every day," wrote Barbier.

Meek and Roof, both 22, met in middle school after Roof's mother asked him to be her son's friend. They drifted apart after Roof moved away in high school, then reconnected months before the shooting when Roof told Meek on Facebook that he saw his old friend's mugshot online.