Boston cops have arrested a man they said shot a 52-year-old woman as she left church last week in Dorchester.

The woman was sitting in a car Friday after leaving Freedom in Christ Ministry, a storefront church on Washington Street, when a gunman opened fire on a rival and a bullet grazed the woman’s head, police said.

James Martin, 22, of Boston was identified through surveillance footage and arrested yesterday afternoon after a foot pursuit.

He is charged with assault with intent to murder, assault and battery with a dangerous weapon, and unlawful possession of a firearm, police said.

Martin is expected to be arraigned in Dorchester District Court today.

Boston police Commissioner William B. Evans said the city is a safer place with Martin off the streets.

“Firstly, I want to extend my well wishes to the victim in this case as she continues to heal and recover from her injuries,” Evans said in a statement last night. “Secondly, I want to commend my officers for the dogged determination that led to today’s arrest. The suspect in this case showed an utter and complete disregard for the safety of others and, without question, our city’s a safer place with him off the streets.”