[This story contains spoilers from Sunday's "Face It, You're Gorgeous," episode of Showtime's Shameless.]

Cameron Monaghan wrapped his run on Showtime's Shameless in fitting fashion Sunday.

The actor, who has played Ian Gallagher since the start of the John Wells-produced series, exited the series during the Oct. 14 episode, in which his character went to jail for his role in blowing up a van as part of a protest against conversion therapy.

The episode delivered a surprise ending for Ian, who spent the bulk of the episode learning survival skills for his two years behind bars. In the closing scene of the episode, Ian's former boyfriend Mickey (Noel Fisher) was revealed to be his cellmate at Beckman Correction.

As it turns out, Mickey — who was supposed to be in Mexico — rolled over on someone and was able to take a deal where he would serve his time. The final scene viewers see of Ian is of him sharing a passionate kiss with Mickey, with the sense that he's going to survive his time behind bars just fine. (Watch the scene, below, as part of a retrospective looking back on the relationship for the fan-favorite couple.)

Mickey was last seen in the penultimate episode of season seven, in which fan-favorite Fisher returned for a two-episode arc and rekindled his love with Ian. At the time, he was being pursued by the feds and had to flee to Mexico. Ian left his boyfriend — and job as a paramedic — to follow him to Mexico but ultimately could not cross the border when he realized he did not want to live life as a fugitive, even though he desperately wanted to stay with Mickey.

Monaghan on Oct. 8 announced that Sunday's episode would be his last with Shameless — at least for now. "The next episode will be my last," Monaghan wrote. "I have known since last year, but I didn't want to give it away too early as I wanted this season to be a surprise for the audience, allowing them to experience Ian’s unsure journey with his character. 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. Goodbye, Ian Clayton Gallagher. We’ll meet again?"

Monaghan becomes the second series regular to leave Shameless this season, joining Emmy Rossum (who plays eldest Gallagher, Fiona). Monaghan's statement implies that he'd be open to returning to the show, which is something Wells hopes Rossum will do at some point as well. For his part, showrunner Wells had to adjust episodes 13 and 14 of season nine to address Rossum's exit, which was something the actress had been debating for a while. While Showtime has yet to announce a 10th season renewal for Shameless, Wells has said that there are "a lot more Gallagher stories to tell," as he hopes the series continues for multiple seasons to come.

"There's no end of stories about maturing in your own family and the pull that families have on us. Placing that within the structure of people who are struggling economically and who have to depend upon each other to survive provides endless story material. It's always a question of how long a cast is prepared to keep playing the characters. I could write this for another 10 years. The satirical underpinnings of this notion that there really is class in America is something that we could write about forever. Every day you pick up the paper and there are 10 other stories you could tell," Wells told THR in an interview pegged to the show's 100th episode.