FLATLANDS, Brooklyn — A teenage would-be thief was stabbed in the eye in Brooklyn when he tried to rob someone at knifepoint and had his own weapon turned on him, according to the NYPD.

Police said it happened around 9:15 p.m. on East 57th Street, between Avenue K and Avenue L, in the Flatlands section of the borough.

The 18-year-old armed with a knife attempted to rob another male, but the would-be victim grabbed the knife and stabbed the teen in the eye, authorities said.

The thief-turned-victim was taken to the hospital and initially listed in critical condition, but has since been upgraded to “stable,” police said.

The NYPD said he was in surgery early Friday morning to have the knife removed.

Officials said the other male who stabbed him was taken into police custody, but had not been charged with anything as of Friday morning.

Submit tips to police by calling Crime Stoppers at 1-800-577-TIPS (8477), visiting crimestoppers.nypdonline.org, downloading the NYPD Crime Stoppers mobile app, or texting 274637 (CRIMES) then entering TIP577. Spanish-speaking callers are asked to dial 1-888-57-PISTA (74782).