WASHINGTON  For more than four years, Frances Fragos Townsend, President Bush’s departing chief terrorism adviser, has worked at the center of contentious antiterrorism programs, but unlike other battle-scarred West Wing colleagues, she is leaving with barely a scratch.

That is partly because she kept such a low political profile.

“I could have been out there,” Ms. Townsend said in a recent interview. “But the president didn’t want me to. He made it clear that he didn’t want me involved in partisan politics. It was less that I avoided it than I just wasn’t pulled into it. I was just not viewed as a political voice.”

Ms. Townsend, 45, a national security lawyer who once worked as a mob and narcotics prosecutor in New York, is stepping down on Jan. 4. She did not know Mr. Bush until she began working at the White House in 2003 as an aide to Condoleezza Rice, then the national security adviser.

Promoted to domestic security adviser in 2004, she became a loyalist and said she was leaving wearied by the acrimony that hangs over Mr. Bush’s last year in office.