Mayor would have forced Castle out of the 12th Precinct because no one would force Captain Gates to retain him. The man said that they needed Castle to remain at Beckett's side because he was the only one able to keep her away from her mother's case. Castle promises that he will uphold his end of the deal to keep Beckett away from the case. In "Pandora" and Linchpin", the investigation of a murder leads Castle and Beckett to reunite with Sophia Turner, a CIA operative on whom he based a major character. Beckett shows some jealousy at how the two are close and Turner tells Beckett that after she and Rick became involved, it was the beginning of the end of their partnership. The trio work together to stop a plot that could escalate into World War III. However, Sophia turns out to not only be part of the plot but is actually a KGB mole who infiltrated the CIA only to be left on her own when the Soviet Union collapsed. Holding Beckett and Castle at gunpoint, she hints that Castle's father was in the CIA and that was why he gained access years ago. She is killed by a true CIA agent as Beckett and Castle help stop the plot. While mourning Sophia, Castle admits to Beckett that she was much truer to the character he created. In "47 Seconds", Beckett reveals to a suspect that she remembered every second of being shot, not realizing that Castle was watching behind the one-way glass mirror. As a result, although Castle tried to hide it, he started to become distant with her, much to Beckett's confusion, concluding that she never mentioned her memory of the event because she didn't return his feelings and didn't want to create an awkward situation. In the season 4 finale, Castle is concerned when a murder case is connected to the conspiracy behind Beckett's mother and is told by the mystery man that Beckett's life is in danger if she investigates. After failing to warn her off subtly, Castle confesses to Beckett how he's been protecting her and she's outraged over his making decisions for her. He confronts her over how he knows she remembers his declaration of love and they both decide they're done. After nearly dying in a confrontation with the killer and quitting the police force, Beckett comes to Castle's apartment,