HERAT, Afghanistan — The two teenagers met inside an ice cream factory through darting glances before roll call, murmured hellos as supervisors looked away and, finally, a phone number folded up and tossed discreetly onto the workroom floor.

It was the beginning of an Afghan love story that flouted dominant traditions of arranged marriages and close family scrutiny, a romance between two teenagers of different ethnicities that tested a village’s tolerance for more modern whims of the heart. The results were delivered with brutal speed.

This month, a group of men spotted the couple riding together in a car, yanked them into the road and began to interrogate the boy and girl. Why were they together? What right had they? An angry crowd of 300 surged around them, calling them adulterers and demanding that they be stoned to death or hanged.

When security forces swooped in and rescued the couple, the mob’s anger exploded. They overwhelmed the local police, set fire to cars and stormed a police station six miles from the center of Herat, raising questions about the strength of law in a corner of western Afghanistan and in one of the first cities that has made the formal transition to Afghan-led security.