An affair-gone-wrong between two actors wound up in court when Michael Rapaport admitted harassing former girlfriend Lili Taylor.

Rapaport, 28, who appeared in "Copland" and "Mighty Aphrodite," pleaded guilty to aggravated harassment Monday. He said he called Taylor 21 times in four days and acknowledged once banging on the window of her apartment around 1 a.m.Acting state Supreme Court Justice Arlene Goldberg issued a protection order, directing Rapaport to stay away from Taylor.

Rapaport was arrested May 18, 1997, after Taylor complained to police that he ignored her requests to leave her alone. She told police that Rapaport said he wanted "to get back with" her. His actions left her "seriously annoyed."

Taylor, 30, played a stalker in "I Shot Andy Warhol" and starred in "Mystic Pizza."