BANGOR, Maine — A Bangor woman displayed real heroism Wednesday when she was sliced by a box cutter while defending a girlfriend being threatened by an ex-boyfriend, according to Bangor police Sgt. Paul Edwards.

“She hit him a couple of times,” Edwards said Thursday. “She got him good, but she paid for it.”

William R. Cocci, 32, of Bangor swung at her with the box cutter, the sergeant said Thursday.

Luckily, the 26-year-old Bangor woman was just “nicked in the face,” Edwards said.

Cocci’s ex-girlfriend is a 32-year-old Brewer woman.

Several people reportedly saw Cocci threatening the women with the knife on Hammond Street and called police about 8:45 a.m. Wednesday.

He was found with the weapon in his bloody hands walking down the city street shortly afterward by Officer Kevin Haefele, Edwards said.

Cocci was charged with three felonies — aggravated assault, criminal threatening and domestic violence assault — as well as with stalking and violating his probation.

“He was attempting, reportedly, to use some sort of GPS to track her down,” Edwards said, referring to the ex-girlfriend. “The word on the street was that he was going to cut her up.”

Cocci reportedly assaulted his then-girlfriend last week, after which she broke up with him and left to stay with a girlfriend, the sergeant said.

His ex just happened to be out Wednesday morning with her Bangor friend, who was walking her dog, when Cocci approached them and the physical confrontation took place.

Cocci was treated for a cut over his left eye, apparently caused by the Bangor woman hitting him, and was taken to a local hospital emergency room for treatment, Edwards said.

Haefele was treated for blood exposure.

After Cocci was medically cleared at the hospital, he was arrested and taken to the Penobscot County Jail. He will be held without bail at least until Friday, when he will see a judge for his first court appearance on the five charges, a jail official said.