Plainclothes police officers took two men into custody Tuesday afternoon after shooting one of the men who allegedly took out a gun when approached by the cops on a Brooklyn street.

On April 19 at about 3:45 p.m. the four plainclothes cops were in an unmarked police car on Gold Street when they saw a wanted man — who, according to the New York Daily News, had an open warrant — outside of 177 Sands St., police said.

When the officers approached the man, they saw an individual accompanying him pull out a gun from his waistband, according to cops. The officers then drew their guns and three of the four cops shot at the armed man.

RELATED: Cops shoot, kill man after he allegedly reaches for gun in Queens

Police say the gunman then ran away into a building at 237 Nassau St. and after a search of the building, police found the man inside a third floor apartment and arrested him on site.

According to police, the man had been shot in his left hand and emergency personnel took him to Kings County Hospital, where he was listed in stable condition.

Authorities are currently trying to obtain a search warrant for the apartment where the alleged gunman was found.

The wanted man, who police first saw on the street, also attempted to run away from the scene but was later arrested, police said.

The officers involved were not injured during the incident but were taken to Methodist Hospital for treatment and evaluation.

Charges for the men are currently pending and an investigation is ongoing.