Lying on the witness stand cost Jamal Sullivan more of his freedom than killing a man.

Sullivan, 29, pleaded guilty to nine counts of perjury on the morning of his trial Monday, receiving a 25-year prison sentence on top of the 20 years he got after pleading guilty last year to manslaughter, two counts of attempted murder and conspiracy to commit murder.

Sullivan’s mistake was taking the witness stand last year, after his guilty plea, and trying to help his co-defendant, Terrance Burton, beat a murder rap.

Sullivan took full blame for being the shooter at a house party melee in New Orleans East in September 2009 that left David Handy dead.

Burton, 24, ended up pleading guilty midtrial and taking a 40-year sentence. District Attorney Leon Cannizzaro’s office then filed a bill of information in July accusing Sullivan of perjury for each of nine lies it alleged he told on the witness stand.

Sullivan’s attorney, Robert Hjortsberg, said after the plea that his client was due to be released in perhaps seven years on his earlier conviction. However, Criminal District Court Judge Franz Zibilich said Sullivan’s 25-year sentence on the perjury counts would run consecutively to the earlier sentence.

“He was in a very difficult spot and ultimately decided that a plea was in his best interest,” Hjortsberg said.