This is such perfect, sweet justice . . . even though it's scary that crimes like this still happen.

A woman was out jogging by herself on a trail in Pittsburgh, Pennsylvania this week when 19-year-old Robert Flynn ran up behind her, grabbed her, and pulled her SHORTS down.  Then he took off running.

But he didn't realize the woman he'd just attacked was a U.S. MARSHAL.

She started sprinting after him, and eventually cornered him on a staircase in an apartment building.  He lunged at her . . . and she kicked him in the groin and took him down with a punch to the face.

He was arrested and charged with aggravated assault, indecent assault, escape, and giving a fake name to a law enforcement officer.  The cops also linked him to another incident where he lifted up a woman's skirt then ran off.