Kalpen Modi, aka Kal Penn, at the White House last year. (Charles Dharapak/AP)

On Thursday afternoon, Modi listened somberly in Superior Court as a judge sentenced the man who mugged him at gunpoint in Dupont Circle last year to 40 months in prison and three years of probation.

Marcellus Chambers, a 20-year-old first-time offender, looked toward the movie star as he offered a brief apology. “I made a mistake,” he said. “I wrote you a letter. I hope that you can forgive me.” Chambers had studied criminal justice at community college before dropping out, his lawyers said, and had struggled with drug use.

Modi, in a navy suit and tie, chose not to speak, reports our colleague Aaron Leitko. But his own written statement to the court, as cited by the judge, apparently described a frightening ordeal that night in April 2010 near 15th and S Streets. Chambers pointed a gun at Modi, racked the slide and ordered him to the ground before taking his wallet, cellphone and BlackBerry, court records state. Arrested two months later, he pleaded guilty this past April to robbery and assault with a deadly weapon.

“Can’t sugarcoat this,” said Judge Robert Richter. “To take somebody and threaten their life in that fashion. . . Smoking marijuana doesn’t make you do that. Somebody in college studying criminal justice should know.”

Modi left the courtroom without talking to reporters. The star of the “Harold and Kumar” comedies, who joined the administration after serving as an ardent Obama campaigner, is due to return to Hollywood this month for a recurring role on the sitcom “How I Met Your Mother.” Neither his L.A. nor Washington reps got back to us for comment.