In a multiplayer game with a friend (hot-seat), I teleported through a town gate into his castle and pressed the spacebar. My hero ended up inside his castle, while his hero, who was inside the castle, went outside, as if they were both mine. Then, I entered his castle (I was red, he was blue :) I double-checked). I brought my hero back outside again by pressing the spacebar, and my hero turned blue, the color of my ally, and I couldn't control him. I'll try to attach the save files, unfortunately, I didn't think to save them right away.
P.S. I've attached a save file from the multiplayer game (hot-seat).
Red's turn. Shakti teleports into the blue player's castle (Shadow Wind).
Enters the castle by pressing the spacebar, and Shakti is now inside the blue player's castle and has turned blue, even though he was a red hero.
The same procedure returns the hero's color from blue back to red (teleport to the red player's castle and press the spacebar...).