Two men pleaded guilty Monday to first-degree assault for an attempted robbery in Buffalo in which the victim was shot twice.

Robert Finch, 21, of Ruhland Avenue, and Wayne Marshall, 19, of Claremont Ave, Town of Tonawanda, face up to 25 years in prison when sentenced by Erie County Judge Sheila A. DiTullio.

The two men admitted that in August 2011 they tried to rob the victim with a loaded gun at Leroy and Fillmore avenues, according to the Erie County District Attorney’s Office.

Marshall shot the victim in the torso and in the back, causing serious injuries. The victim is recovering from injuries related to a bullet lodged in his spine, lacerated liver and kidney and temporary paralysis ofhis leg, District Attorney Frank A. Sedita III said.

Sedita credited Buffalo police detective Cedric Holloway, who confronted Finch with surveillance video from a corner store to debunk his claim that he was not involved in the crime and did not know Marshall.

The county’s crime analysis center also identified Finch and Marshall as Guilford Street Gange members by using YouTube videos that showed the two rapping about violent acts, Sedita said.

Marshall will be sentenced on Wednesday and Finch on Dec. 5.