Cameron Monaghan’s “Shameless” exit provided many tears, but it also gave him a happy ending — or at least as close to a happy ending as Ian can get in prison.

Last week, Monaghan announced that he had chosen to leave the Showtime dramedy midseason. He didn’t exactly specify a reason to leaving, but it sounds like the actor was ready to move on to other projects. “All good things come to an end. An old cliche, but one that rings true with a sincerity and clarity especially in moments like these. Everything ends,” he wrote, in part, on Instagram.

“This role has been a joy to inhabit, a wild and special ride, and I’d like to thank #Shameless as well as you, the viewers, for being there with him,” he added. “Goodbye, Ian Clayton Gallagher. We’ll meet again?”

Why Did Ian Leave Shameless?
Cameron Monaghan left "Shameless" Season 9 in episode 6. Showtime/Paul Sarkis

“Shameless” Season 9, episode 6 showed Ian preparing to head to jail. He was sentenced to two years in prison for blowing up a van to protest conversion therapy. Since it looks like this facility is a lot rougher than where he previously spent time behind bars, Ian was trying to prepare for prison throughout most of the episode.

In the end, he spent some quality time with his family (except Emmy Rossum’s Fiona, who is dealing with money drama and discovers her boyfriend has a secret family). His Gay Jesus followers don’t show up to say goodbye, proving he can only count on family. He shares some big hugs with his siblings as well as Kev (Steve Howey) and V (Shanola Hampton). Then, he heads to the big house.

Ian walks into the prison in a yellow jumpsuit, and he’s surrounded by burly men who are eyeing the new inmate. Ian looks miserable as he’s shown to his cell. He puts his belongings on the top bunk when the door opens again to reveal Mickey Milkovich (Noel Fisher).

Gallavich Shameless
Noel Fisher (left) returned for Cameron Monaghan's last episode of "Shameless." Showtime/Paul Sarkis

Ian last saw Mickey after he’d broken out of prison and was heading to Mexico dressed as a woman. Ian decided not to go with his love, but it looks like Mickey’s plan took a turn.

Ian stands there in shock as his ex-boyfriend explains. “I rolled on a cartel I was working for, and in exchange, guess who gets to pick where he gets locked up?” Mickey says, implying that he may have gone to the authorities after Ian was sentenced.

The character suggestively says he has the bottom bunk and lies down with a grin on his face. It takes Ian a moment to break into a smile and share a passionate kiss with his love. Mickey and Ian got their happy ending after all, despite their prison sentences. It seems like it’s only a matter of time until this power couple is running the prison, right?

Fans were delighted to see Mickey back on the show. They took to Twitter to share their feelings:

Ian won’t be the only character to leave “Shameless” in Season 9. Emmy Rossum also announced that she’ll depart the series at the end of the season, which will air in 2019.

“Shameless” Season 9 continues with the midseason finale on Sunday.