When a bear wanders down Evergreen Terrace, Mayor Quimby raises taxes to fund a new bear patrol, but the townspeople protest. To distract them, he blames the taxes on illegal immigrants, and calls for the deportation of all illegal immigrants from Springfield. Apu realizes that he will have to be deported, as his visa is expired, and gets a fake ID from Fat Tony. Lisa realizes that he can apply for amnesty, so Apu takes a test and is allowed to stay in the country.
A bear wanders from the forest into Springfield, and eventually on Evergreen Terrace. Ned Flanders comes home and is quite scared by the bear and runs to his house. Homer then tries to leave the house by using the powerline, Chief Wiggum shoots a blow dart at the bear, but accidentally hits Barney. Wiggum's second shot hits the bear, knocking it out. When the neighborhood sees what the bear did, Homer says he's tired of the constant bear attacks (even though Ned says this is the only bear attack he's ever seen). Homer leads an angry mob to City Hall to get the mayor to start a bear patrol to make sure no bears ever come into Springfield.
Mayor Quimby approves and starts the Bear Patrol. Unfortunately, the Bear Patrol proves to be costly due to its excessive use of high-tech equipment and vehicles, and this extravagance is reflected in the extra 5 dollars the citizens have to pay in taxes to keep the patrol running. Homer is outraged saying that it's the biggest tax increase in history, before Lisa corrects him saying that it's the smallest tax increase in history. Still outraged anyway, he leads another mob to City Hall, and—once again showing how illogical Springfielders are—they aren't willing to give up the bear patrol but also refuse to pay for it. Mayor Quimby, thinking quickly, scapegoats undocumented immigrants, blaming the high taxes on them, and announces that there will be a Proposition where the townspeople will vote on whether to deport these immigrants.
The residents of Springfield are shown people putting up signs in favor of Proposition 24, to deport the undocumented immigrants. Homer is in the Kwik-E-Mart talking to Apu, and Apu reveals that he is an undocumented immigrant (He never got around to going through the citizenship process after his student visa expired). Apu decides he desperately does not want to be deported, so he gets a fake United States citizenship documents from Fat Tony. After trying to act like an American for one day, Apu decides he can't keep it up and that he has to get legal American citizenship the fair way, because of a memory of his mother telling him, "never forget who you are." Homer asks Selma to marry Apu, but she would rather "eat poison" than marry Apu. Apu plans to take the United States Citizenship test.
Homer takes Apu home to help him study. Apu initially displays a good knowledge of American history, but Homer continually corrects him and gives him wildly inaccurate information. Homer then gives Apu his 9th grade history notes, and leaves him alone to study all night. However, Apu falls asleep. When he wakes up, he realizes he has slept all night and says he's forgotten everything that Homer taught him. Lisa then says, "Perfect", and then leads him off to give him the correct answers,
Apu takes the citizenship test along with Dr. Nick Riviera, Akira, Bumblebee Man, Luigi, Groundskeeper Willie, Kako and a disguised Moe (who was being mean to immigrants throughout the episode). Apu passes and the Simpsons throw him a party congratulating him on becoming an American. The final shot of the episode is Willie being deported suggesting he failed the citizenship test. As the ship he's on heads out to sea, he says, "Ingrates!"