A 22-year-old man has been charged with taking part in a shootout in Frankford that left his 10-year-old nephew critically wounded this week, the Philadelphia District Attorney’s Office said Friday.

Officials said Ernest Richardson was walking with the boy, Semaj O’Branty, after school Wednesday near Torresdale Avenue and Margaret Street when a gunman in the backseat of a red Pontiac opened fire on them.

Richardson pulled his own handgun and returned fire before going to the aid of his nephew, who had been shot in the head, officials said.

Police arrested Richardson at the scene and recovered a revolver from a recycling container, authorities said.

Richardson has been charged with recklessly endangering another person and weapons possession charges, including being a person with a prior conviction carrying a handgun, the District Attorney’s Office said.

Bail has been set at 10% of $400,000 for Richardson, who had been sentenced to a 9- to 23-month prison term in April for an earlier weapons conviction, according to court records.

Police are still seeking the gunman who fired from the car. The boy remains at St. Christopher’s Hospital for Children, where he was last reported to be in critical but stable condition.

Investigators have released surveillance images of the red Pontiac G6 sought in the shooting and the Fraternal Order of Police, the union that represents Philadelphia police, on Friday offered a $5,000 reward for information leading to an arrest in the case.

Anyone with information can call 911 or 215-686-TIPS (8477).

Staff writer Chris Palmer contributed to this article.