Eddie Ramirez, the nighttime animal caretaker at the Manhattan Zoo is bludgeoned to death with a snake hook and tossed his body into a pit filled with deadly snakes. Ramirez got a text threatening him for money he owed and the detectives find $10K in cash at his place.
Eddie was taking an English as a Second Language class. They believe the text came from someone in class but no one will talk to the police. Castle goes in undercover as a French speaking student to figure out who sent the text. He pinpoints Allistair. Alistair sent the text but has an alibi for the murder.
Castle has writer’s block because he can’t follow Beckett any longer. He heads to the P.I. office and finds Hayley and Alexis working on corporate cases.
Perlmutter tries to set Beckett up with his identical twin, Edgar.
Turns out that Eddie was helping several people in his class including Ida from Senegal and Akmed who’s neighbor was missing. Eddie told Akmed that the neighbor was involved in some sort of dangerous conspiracy that involved Marco Sutter. When Espo and Ryan go to pick up Sutter, he opens fire on them before they arrest him.
They find a bus locker key on Sutter. When Espo and Ryan go to find out what’s inside, they end up being arrested by the FBI who have been working a case for two years. They give Beckett attitude until she points out they didn’t send in any paperwork about their stakeout.
Turns out that Judge Jason Caldwell deported Anita Rodriguez after she couldn’t pay off Mark Sutter who was extorting her. Caldwell is getting kickbacks from a private prison in Texas that hold detainees. Eddie confronted the judge and the FBI has the judge under surveillance.
Castle and Hayley work together to try and trick they judge into confessing but it doesn’t work. The FBI helps Beckett, Espo and Ryan put the pieces together. The judge figured out that Eddie was a former cop in El Salvador and hired Alonzo Sanchez, an enforcer for an El Salvadoran gang. Eddie had killed his brother when he was a cop. Alonzo swears he didn’t kill Eddie despite the judge reaching out. Eddie convinced him that he had actually protected his brother.
Turns out the ESL teacher was partnering with the judge and turning in his students to get kickbacks as well. When Eddie figured it out, he killed him.
Castle invites the entire class to his loft for dinner. Alexis will be taking over as the ESL teacher.
Castle has a flashback while eating a Korean dish at the class and thinks he was in Korea during his disappearance. Later, he has a dream where he realizes he wasn’t in Korea but Koreatown in Los Angeles. He tells Kate he needs to head to L.A. to figure it out.