A Queens man was sentenced Friday in Manhattan to 5 years in prison for a plot to blow up synagogues -- the first successful prosecution under New York State anti-terror laws passed in the wake of the Sept. 11, 2001, attacks.

Mohamed Mamdouh, 22, and co-defendant Ahmed Ferhani, 28, were caught in a controversial NYPD sting in 2011. Defense lawyers had claimed that an undercover agent played an outsized role in encouraging the plot, and the FBI -- which typically prosecutes terrorism -- stayed away from the case.

Ferhani, portrayed as the mastermind, pleaded guilty in state court in December and was sentenced to 10 years.

District Attorney Cyrus Vance's office claimed at the time that Ferhani was the first conviction under the state terror laws, but records reviewed Friday indicated that Mamdouh entered an unannounced guilty plea in February 2012 that made him the first.

Prosecutors declined to comment on whether Mamdouh secretly cooperated against Ferhani. At the sentencing, prosecutor Gary Galperin told Judge Michael Obus that Mamdouh deserved a lower sentence because he never would have acted without Ferhani's encouragement, and had expressed regret.

Mamdouh, a Moroccan immigrant, and Ferhani, an Algerian native, were arrested in May 2011 after an eight-month undercover operation. They were charged with agreeing to attack a synagogue and purchasing weapons to help carry out the attack.

Ferhani claimed the undercover NYPD agent played on emotional and financial dependencies to encourage him.

Obus said the five-year sentence on conspiracy and weapons charges will run concurrently with a 3 1/2-year sentence Mamdouh is serving on a Queens burglary conviction.