President Obama on Friday granted Christmastime commutations to a record 95 federal prisoners — including 40 who had been serving life sentences, mostly for crack and cocaine crimes.

Almost all of those being freed are nonviolent drug offenders who behaved well in prison and who would have received shorter sentences under current rules, officials said.

The commutations, which Obama signed before his year-end news conference Friday, are the most any president has issued at one time and are part of a continuing White House effort to rethink harsh and expensive mandatory sentences for thousands of nonviolent drug offenders.

With one year left in his presidency, Obama has now commuted the sentences of 184 prisoners, more than any president since Lyndon Johnson, who granted clemency to 226.

The only New York state resident on the clemency list is Ramona Brant, 52, of Freeport, LI.

The mother of two had been serving a life sentence since 1995 for conspiracy to possess cocaine with intent to distribute.

“It’s the best news,” her eldest son, Barber, 25, who was 4 when his mother was imprisoned, told Newsday.

“I can’t stop smiling. I’m so excited.”

Brant has said all she did was accompany her children’s father during drug buys and pass along his phone messages.

Brant also had a history of suffering domestic violence at the boyfriend’s hand and had no prior criminal history.

She and most of the inmates with commuted sentences will be released in April.

Obama issued outright pardons for an additional two convicts who were sentenced to probation or home detention.

Not everyone on the list was a nonviolent drug offender.

Carolyn Yvonne Butler of Texas was convicted of robbing three banks in 1991 with a gun. She got a 48-year prison sentence under mandatory sentencing guidelines.

“I am granting your application because you have demonstrated the potential to turn your life around,” Obama told each of the prisoners in personally signed letters.

“Now it is up to you to make the most of this opportunity.”

Nearly half the roughly 200,000 convicts in federal custody are there for drug offenses, statistics show.

“The president’s decision today to commute the prison terms of 95 individuals is another sign of this administration’s strong commitment to ensuring fairness in the criminal justice system,” Deputy Attorney General Sally Yates said.

Justice Department officials expanded the criteria for clemency last year and assigned a team of lawyers to review applications.

Additional reporting by Geoff Earle