"Castle" has shut the "iron gates" on Penny Johnson Jerald.

Jerald will not return to play Captain Victoria "Iron" Gates when "Castle" returns for season 8 in the fall, according to TVLine. The decision came as a "surprise" to the actress who joined the ABC series at the beginning of season four.

"To my Castle fans around the world, as of late yesterday I am surprised and saddened to learn that I will no longer be a part of the Castle family. Thank you all for your support and love. Hugs from PJJ," she tweeted on Friday night.

The casting decision is part of a larger plan to change the creative direction of the show under new showrunners Terence Paul Winter and Alexi Hawley.

Gates' exit could set up a plot line for Det. Kate Beckett (Stana Katic) to become the 12th Precinct's new commander after acing her captain's exam at the end of season seven. Beckett is also mulling a possible run for New York State Senate.

Jerald's character took over for Captain Roy Montgomery (Ruben Santiago-Hudson), who was killed trying to keep Beckett safe from the people who killed her mother at the end of season three.

Before joining "Castle," Jerald most notably starred on "24" as First Lady Sherry Palmer and as Larry Sanders' personal assistant, Beverly, on "The Larry Sanders Show."