A Good Samaritan stopped a man from sexually assaulting a woman on a subway train in Brooklyn, prosecutors allege. 

The do-gooder straphanger, identified in a criminal complaint as Maurice Osborne, was in another car of the No. 3 train in Park Slope on Wednesday when he heard and saw the man attack the 28-year-old woman, prosecutors said. 

Osborne rushed over and pulled 40-year-old suspect Alvaro Denica off the woman and kept him from leaving the train until police arrived, authorities said. A criminal complaint said that Osborne received six stitches for a gash above his eye. 

Osborne told the New York Post he "beat" the suspect up. "She said he was about to rape her -- that's when I beat him up. All he said was, 'I didn't do anything.'"

Denica was arrested on charges of assault and attempted sexual abuse.  

Andre Gordillo, a manager at the restaurant where Denica has worked since 2011, told the Daily News that he couldn't believe his employee was behind the attack. "He's a good employee," he said. "We've never had a problem with him." 

Denica was being held on $150,000 bond after an arraignment in Brooklyn Criminal Court on Thursday.