Suffolk prosecutors waited more than three years to tell the defense for a Brentwood man charged with murder that men who took part in the crime had identified someone else as the killer, a defense attorney said.

And because that information came after the trial of Elvi Portillo Aguilar had started, it was practically useless, said the lawyer, Craig McElwee of Hauppauge. The information should have been turned over when police knew it, in August 2012, McElwee said.

He cited what is known as the Brady rule, which generally requires prosecutors to turn over information helpful to the defense as soon as it is known.

McElwee asked Suffolk County Court Judge Stephen Braslow for a mistrial last week, which Braslow denied. Closing arguments in the case are expected Thursday.

Portillo, 27, is charged with second-degree murder in the shooting death of Edgar Perez Avalos, 30, on Aug. 18, 2012 outside Migueleno’s sports bar in Brentwood. Prosecutors say Portillo watched as two of his fellow MS-13 gang members, Elvis Sazo and Jose Misael Hernandez, argued with Perez and another man and then beat them. After Perez was unconscious on the ground, prosecutors say Portillo walked over and shot him once in the back of the head.

Sazo and Hernandez pleaded guilty to assault and have since been deported to El Salvador.

When they were arrested, they both identified other men as the shooter. Hernandez gave a statement saying the shooter was known to him only as Juan, while Sazo said he knew him as “El Flaco,” Spanish for the skinny man.

Portillo’s nickname is “El Desconocido,” or the unknown man, McElwee said.

McElwee said if the defense had known of these statements in 2012, it could have questioned Sazo and Hernandez and others and pursued that as a possible defense.

advertisement | advertise on newsday

“There’s absolutely no way for the defense to properly look into these claims” now, McElwee told Braslow last week. “This is a classic Brady situation. . . . The prosecution does not get to determine whether or not this information is credible, in its opinion.”

Assistant District Attorney Kathleen Kearon argued that in light of Portillo’s eventual confession and other evidence against him, the value of what Sazo and Hernandez said is minimal.

Braslow, in denying McElwee’s mistrial request, said the statements were “not material, it was investigatory.”

McElwee told Braslow his ruling runs counter to the Brady rule and gives prosecutors complete discretion in deciding what evidence is relevant for the defense.

McElwee said Wednesday if his client is convicted “it leaves us with an appealable issue.” The point of the Brady rule is to prevent prosecutors from crippling defenses by withholding evidence, he said.

Kearon said Wednesday the issue is settled.

“The court found there was no prejudice to the defendant,” she said. “The court ruled in our favor.”