A 77-year-old Dorchester man’s good fortune was short-lived when was he was killed after winning a cash prize.

According to Assistant District Attorney Amy Martin, Ramon Rodriguez-Delgado fatally stabbed Marcelino Perez after watching the victim receive prize money from a private ­lottery. Rodriguez-Delgado lived in a building across the courtyard from the victim’s Shandon Street apartment and saw the money being delivered to Perez.

On the afternoon of July 26, security cameras captured Rodriguez-Delgado leaving Perez’s building only to return eight minutes later. Rodriguez-Delgado then stayed in the building for several minutes before leaving again.

He then went back into the building wearing different clothes and stayed for about 30 minutes. Prosecutors say that is when he stabbed Perez multiple times. Relatives of Perez found his body inside the apartment later that day.

Rodriguez-Delgado, who was arraigned in West Roxbury Municipal Court yesterday, will be held without bail.