After an intense seven-month investigation, NYPD detectives Friday arrested a Queens man in the killing of an aide to Gov. Andrew M. Cuomo during a wild gunfight at a West Indian celebration in September, an official said.

Micah Alleyne, 24, was charged with second-degree murder, criminal possession of a weapon and reckless endangerment in the fatal shooting of Carey Gabay, 43, on Sept. 7, according to court papers unsealed Friday in Brooklyn.

A one-page criminal complaint stated Alleyne, who police say is from Trinidad, was involved in a gunfight around the Ebbets Field Houses. Witnesses gave police information that Alleyne was involved in the gunfire, the complaint said.

Alleyne was held without bail after arraignment Friday morning in Brooklyn Criminal Court, a spokeswoman for Brooklyn District Attorney Kenneth Thompson said.

Gabay, who worked as an assistant counsel to Cuomo and later as a deputy counsel for the Empire State Development Corporation, was gravely wounded in the predawn hours of Sept. 7 while he was among a crowd celebrating the festival of J’Ouvert, an event that preceded the West Indian Day parade later that day. Gabay, who was in a coma and on life support, died Sept. 15.

A website set up to memorialize Gabay said he was originally from Jamaica and had lived in city public housing before he graduated from both Harvard University and Harvard Law School.

In October, police said at least four people, including one woman, were being sought in the gunfight in which an errant shot hit Gabay in the head. NYPD officials told Newsday that investigators had used facial-recognition software to identify suspects captured on video holding guns or shooting.

Investigators had examined more than 300 videos since the shooting and forensic experts went over 27 mostly 9-mm shell casings found at the scene.

NYC, in your inbox.

In a statement, Thompson said other people were being pursued in the investigation.

“As I have said from the beginning, we are determined to get justice for Mr. Gabay and his family. And we will continue to press forward until we hold everyone responsible for his death accountable,” Thompson said.

In a separate statement, Cuomo also praised investigators.

“Carey Gabay was an exemplary public servant who lost his life in a senseless tragedy,” Cuomo said. “Today’s arrest is a major step forward in the pursuit of justice for Carey’s family and loved ones. I commend the investigators and prosecutors for their tireless efforts to ensure those responsible for Carey’s death are held fully accountable for their actions.”

CORRECTION: An earlier version of this story misstated where the suspect resides.