A 17-year-old Brooklyn boy has been accused of shooting a Binghamton man in front of a Robert Street apartment house.

Authorities say Dajhoun Perez faces several charges, including two counts of attempted murder. He also was charged with criminal use of a firearm and criminal possession of a weapon.

Police say Perez shot a 21-year-old man early Wednesday afternoon near Robert and Virgil streets. The man sustained a leg wound. He was treated at Wilson Medical Center in Johnson City.

Detectives say after the shooting, Perez ran inside 4 Robert Street.

A city police SWAT unit was sent to the scene and Perez surrendered when an officer directed him to leave the building.

Police Wednesday evening recovered a 40-caliber handgun they believe was used in the shooting. The loaded gun was found in the basement of the apartment house.

Investigators recovered three spent shell casings outside the house. Some witnesses said they heard more than three shots.