When the Simpson family is at the Costington's department store, Bart uses the wedding gift registry as a prank to register himself and his bride, "Lotta Cooties", for wedding presents. Bart invites many people to his so-called "wedding" and plans to take all the unused gifts back for store credit, but he is stopped in his tracks by Chief Wiggum, who arrests Bart. He tries to bribe Chief Wiggum with the wedding presents, but Chief Wiggum only accepts cash bribes, as stated on his badge. Bart is sentenced to six months of juvenile detention by Judge Constance Harm.
At the detention center, Bart is afraid he will be buried alive in the sandpit or photographed being punched while going down a slide. He soon notices that the girls' Juvie is on the other side of a chain-link fence. Bart attempts to schmooze with these girls, only to have them attack and immobilize him. One of the girls, Gina Vendetti, uses a knife to destroy Bart's uniform, threatening to castrate him next time he comes near their fence. Bart's problems continue when he is partnered with Gina for the dance by the warden. When they are dancing, Gina escapes with Bart using a rope, finding themselves on a window ledge. Due to the fact that they are handcuffed together, Gina is forced to bring a reluctant Bart along before the window can be closed (though he only comes after she kisses him). Slowly, they gain each other's trust.
On the lam, the duo look for a blacksmith who can remove their cuffs. They are freed, but after it happens, Gina is alone and forlorn. She starts crying and admits to Bart that she has no family. The police come and arrest them (and a bear that Cletus said would attack Chief Wiggum), telling the Simpsons that now Bart will stay in Juvie even longer. Gina, feeling terrible, confesses that she was behind the escape, clearing Bart of further charges. The Simpsons and the warden step in to help Gina feel better for being without family, offering a Mexican food feast in her cell at the end.