QUEENS VILLAGE (PIX11) -- A man opened fired on two plainclothes cops who were on patrol in an unmarked car Saturday evening in Queens, critically injuring one officer and prompting a vast search of the area that led to the apprehension of the suspect shortly thereafter.

Police Commissioner Bill Bratton said Police Officer Brian Moore, 25, had just asked the man, Demetrius Blackwell, 35, a question when the suspect opened fired.

Moore was shot in the cheek. His partner, Officer Erik Jansen, 30, who was not hurt, immediately radioed for help.

Moore was taken in a squad car to Jamaica Hospital, where he underwent surgery and was in critical but stable condition.

The officers were conducting a patrol about 6:15 p.m. in the area of 212 Street and 104 Avenue when the encounter happened, police said.

According to Bratton, Moore, who was in the driver's seat, and Jansen noticed Blackwell "walking and adjusting an object in his waistband."

The police officers monitored Blackwell as he walked south on 212th Street and then east onto 104th Road.

Moore pulled up his car behind the suspect, and asked him a question. The suspect, police said, immediately brandished a firearm from his waistband, turned toward the cops, and fired several times into the car, striking Moore. Neither officer had a chance to return fire.

Blackwell fled through an alley on 104 Road. Blackwell was arrested about 90 minutes later at 104-25 212 Place. The weapon had not been located, and police were obtaining search warrants.

Authorities said Blackwell has a long rap sheet, including criminal possession of a weapon and robbery.

Moore lives on Long Island and will mark his fourth year on the job in July.

Blackwell, who police say has a long rap sheet, was charged with one count each of attempted murder and assault, and two counts of criminal possession of a weapon. He is set to be arraigned Sunday night.

The shooting comes less than six months after officers Rafael Ramos, 40, and Wenjian Liu, 32, were shot and killed execution style while sitting in their patrol car.

The shooter, 28-year-old Ismaaiyl Brinsley, posted to social media hours before the shooting that he would be "putting wings on pigs today" to avenge the police-involved deaths of Eric Garner and Michael Brown.

Two weeks later, two plainclothes officers in the Bronx were shot twice while responding to a grocery store robbery. Two suspects were arrested in connection with the shooting.