I actually posted this originally over in the Psychology and Neurology SE in hopes of getting specific, helpful, psych-related responses from people who were actually knowledgeable in the field, but they suggested I ask over here in Writing, so alas, here I am.
In the book I'm working on, Group A and Group B are rival organizations gearing up for war. Group A has an agent (we'll just call her Agent) they're planning on sending undercover into Group B so that she might start picking away at them without them noticing, weakening them for when Group A finally attacks. When the story starts, Agent has already been undercover in Group B for almost a year, having spent nearly a year before that immersing herself in her false identity, getting Group B's attention, then being held captive while they tested her loyalty.
Agent ends up essentially becoming an assassin for Group B, hunting, torturing, and killing people for their cause (so of course some of these people actually have ties to Group A, the group she's actually working for).
Meanwhile, a third party group (Group C) is searching for Agent, wanting to get her out of this situation and bring her home. They're shocked to find her working for Group B, so she confesses to them that she's actually working for Group A and they need to leave her alone before they blow her cover. But it's too late—Group B orders her to deal with these people, and she ends up shooting one of them in order to make it look like she's obeying (she's got a plan though and wasn't shooting to kill). To the other members of Group C, it looks like she was following Group B's orders and was lying when she told them she was undercover for Group A. They want to believe she was telling them the truth, but her actions say otherwise, and other things she has done/told them throughout the story lead them to believe maybe she was originally working for Group A but got so deep undercover that her loyalty shifted to Group B. This is kind of what Agent is hoping people will think as well (though she is truly still working for Group A).
So now you've got some background, and hopefully it all made sense. What I'm trying to do is come up with an actual scientific/psychological explanation for the (theoretical) shift in allegiance. Members of Group C will speculate that Agent spent so much time immersing herself in her role and doing such...intimate work for Group B that her loyalty began to shift without her even realizing it. Group B's leader is also very manipulative and they might even wonder if he somehow kind of brainwashed her.
Stockholm Syndrome was the first concept I thought of to describe what [Group C thinks] is happening to this character, but the story is science fiction and takes place in a fictional universe so I can't actually use "Stockholm Syndrome" in as many words because it's so Earth-based. I'm not convinced it's the best fit for this scenario in the story either. Obviously it works in terms of Agent supposedly developing loyalty toward the people she was supposed to be working against. But once she has established her role in Group B, she isn't being held captive or anything (though she was for a time while they were vetting her, and that experience was pretty grueling and traumatic). She's free to come and go from their base as she pleases.
I also tried reading up on dissociative disorder and its variations, and parts of them do and don't fit as well. Agent originally started working for Group A because she owed them a favor, so she doesn't really want to be doing any of this at all, but it's too late to get out now. She has military experience and has survived numerous traumatic events, and obviously her current undercover work would require her to stay mentally and emotionally detached (actually she has always been pretty emotionally detached).
So taking the information you know into consideration (again, hopefully it all made sense), what psychological phenomenon could most accurately describe Agent's shift in loyalty after spending too much time in her undercover role in Group B (or at least what Group C perceives as such)?