TRENTON, NJ — A Trenton man playing a late-night prank on a friend by donning a mask and staging a mugging was fatally stabbed by the unsuspecting friend as his young wife watched in horror from a window, police said.

The friend was charged with the killing.

Police said Carlos Rodriguez, 22, wanted to fool Miguel Perez, 18, into thwarting a mugging. Just before midnight Monday, he called Perez and told him that two masked men were attacking their friend Daniel Barreto in an alley near their homes. Perez said he would be right out. They put on stocking masks, posed as muggers and waited. The plan was to frighten Perez and have a good laugh.

Then Rodriguez and Barreto, 22, put on stocking masks, posed as the muggers and waited. The plan was to frighten Perez, then pull off the masks and have a good laugh, Barreto told police.

But when Perez encountered the masked men in the rainy darkness, he pulled a knife and stabbed one of them in the chest.

It was Rodriguez. But Perez didn't know until the bleeding man pulled off his mask, looked into his friend's eyes and cried out, "You stabbed me."

"I didn't know this was a joke," Perez cried in response, witnesses told police.

He and Barreto tried to help Rodriguez back to his apartment, but he collapsed. They rushed him to Mercer Medical Center, where he was pronounced dead just after midnight.

At first, police said, the friends told them that masked muggers had stabbed Rodriguez. But when questioned in detail, they revealed the prank.

Police charged Perez with aggravated manslaughter and unlawful possession of a weapon. He was held last night in the Mercer County Youth Detention Center.