A judge repeatedly called a Brentwood gang member convicted of fatally shooting a man who had been beaten unconscious a “coward” before imposing the maximum sentence of 25 years to life.

Following a trial last month, Elvi Portillo Aguilar was found guilty of second-degree murder in the Aug. 18, 2012 slaying of Edgar Perez Avalos.

“It’s unsettling to this court how someone can cold-bloodedly, unrepentantly, without remorse, murder somebody in the fashion you murdered this poor individual,” Suffolk County Judge Stephen Braslow said, addressing Portillo in a Riverhead courtroom.

Braslow said Portillo, 28, shot the victim in the back of the head as he lay on the pavement outside a Brentwood bar — “as a coward does.”

“We live a civilized society, sir. People like you aren’t allowed to live with us in our society,” the judge said before handing down the prison term.

Assistant District Attorney Kathleen Kearon later said Portillo deserved the maximum punishment for “a cold-blooded murder.”

advertisement | advertise on newsday

Defense attorney Craig McElwee of Hauppauge said outside court there was no evidence presented at trial that his client was a member of MS-13 as prosecutors alleged.

“He’s maintained his innocence, and he intends to appeal,” McElwee said.

Jurors said they were initially divided during their 5 1/2 hours of deliberations over two days. But several jurors said they were influenced by a video of Portillo describing the killing to homicide detectives and laughing when asked if he intended to kill the victim.

Two other men — also members of MS-13 — had beaten Perez, 30, unconscious outside Migueleño Sports Bar at about 4 a.m. following a dispute. Portillo got out of a car, walked up to Perez and shot him, according to prosecutors.

The other men pleaded guilty to assault and have since been deported to El Salvador. But they identified a different person as the shooter — information that wasn’t divulged to the defense until the trial began.

At trial, McElwee unsuccessfully argued that was a violation of what is known as the Brady rule, which generally requires prosecutors to turn over evidence favorable to the defense as soon as they have it.

McElwee said if he’d had that information much sooner, he could have investigated and prepared a more effective defense.

On Tuesday, McElwee moved to vacate the conviction on the Brady rule argument and other grounds, including the prosecution’s reference at trial to the murder weapon as a “gang gun” linked to another killing.

advertisement | advertise on newsday

Braslow rejected the motion.