The man accused of fatally shooting another subway rider in an unprovoked attack on board a Q train on Sunday has been taken into custody and charged with murder in the second degree and criminal possession of a weapon in the second degree, the NYPD said Tuesday.

Andrew Abdullah, 25, was taken into custody in connection with Daniel Enriquez' death Tuesday afternoon, police said. 

Enriquez, 48, was shot and killed by a gunman as he was riding the Q train from Brooklyn into Manhattan Sunday morning, police said.

According to Chief of Detectives James Essig, Abdullah had eight prior arrests and a criminal record that extends back to August 2016, and was a member of the Nine Block gang.

Flanked by Mayor Eric Adams, Chief of Transit Janno Lieber and other NYPD officials, Police Commissioner Keechant Sewell blasted the state’s criminal justice system, and called for reforms to its bail laws.

“The murder of Daniel Enriquez was every New Yorker’s worst nightmare,” Sewell said.

“The violence on the Q train last Sunday morning was committed by another repeat offender who was given every leeway by the criminal justice system,” Sewell added. “We cannot and will not stand for it.”

“We got a killer off our streets,” Adams said, “but far too many killers are back on our streets through a revolving door criminal justice system.”

Essig said a regional task force received word Monday night that Abdullah intended to turn himself in.

“[Abdullah] was given ample time to turn himself in,” Essig said. “And [the Regional Task Force] found him in front of 49 Thomas today and brought him in.”

In a statement released Tuesday afternoon, The Legal Aid Society, which is serving as counsel for Abdullah, said it had been “actively speaking with the New York Police Department and the New York County District Attorney’s Office to negotiate [Abdullah’s] surrender,” while calling the circumstances surrounding his arrest “completely inappropriate and unwarranted.”

“Before Andrew Abdullah could voluntarily surrender himself to the local precinct, he was needlessly ambushed out front of our Manhattan Trial Office by City Marshalls [sic], denied of his opportunity to first consult with counsel,” the statement said.

Abdullah “is presumed innocent and entitled to counsel and a robust defense,” it went on to say.

“At this preliminary moment in the case, we caution New Yorkers from rushing to judgment, as we are just beginning our investigation and reviewing evidence,” it added. “Mr. Abdullah deserves vigorous representation from his defense counsel and that is what The Legal Aid Society will provide."

Adams also extended his condolences to those affected by a mass shooting in a Teas elementary school, where 14 children and one adult were killed Tuesday.

"Also want to put my heart out to the family members in Texas elementary school. A mass shooting,” he said. “These shootings are happening far too often. And the response is not meeting the level of threat and danger that we are experiencing. Not acceptable. We will never surrender our streets to violence."