An Oregon man convicted of attempted murder said he wanted to get married before he went to prison, so the judge who sentenced him agreed to preside over the courtroom wedding Friday, local media reported.

A Portland jury had convicted 24-year-old Tyrone Allen on charges including attempted murder after police said he shot at a rival gang member in March of last year. The conviction carries a minimum prison sentence of 10 years.

But before his sentencing, Allen told his defense attorney that he wanted to marry his longtime friend Trisha Romero that day, according to KOIN. “They were happy,” attorney Alicia Hercher told the news station.

She reportedly asked Judge Gregory Silver if he could stick around for the wedding, and he said yes. Prosecutors didn’t object, but they didn’t stay for the ceremony.

After the sentencing, the judge posed with the couple as they said “I do.” Allen’s hands and feet were shackled. Family and friends watched.

Since Allen had been sentenced to prison, he and Romero couldn’t kiss, or touch each other in any way. But after a quick, 5-minute ceremony, the husband was escorted out of the courtroom, and eventually, to prison.