Dame Eliza Manningham-Buller is to leave her post as director general of the British security service, MI5.
Dame Eliza Manningham-Buller has been at MI5 for more than 30 years
Dame Eliza, 58, who has been in the post since October 2002, will leave by April and her replacement will be appointed by Home Secretary John Reid.
She said she had planned the move early last year, before the attacks in London, after 33 years in the service.
She added that MI5 was facing two big challenges - the "serious threat" and the need to adapt to that threat.
In a statement, she said: "By April 2007 I shall have been an officer of the security service for 33 years, the last 10 as either deputy director general or director general.
"I decided in early 2005 that it would be time by then to stand down.
"I have been privileged to lead the service when it is facing the two challenges of a very serious threat and the consequent need to grow and change at a dramatic rate to tackle that threat.
"I'm confident that the service will continue to serve the UK to the best of its ability and I shall watch its progress with great interest."
Dame Eliza's resignation was agreed with the former home secretary, Charles Clarke, who was sacked in May.
The suicide bombings on London's transport network in July last year put her under the spotlight and Dame Eliza has recently spoken of the continuing terror threat facing Britain.
Mr Reid said: "Eliza has given 33 years of dedicated service to the nation and we owe her a tremendous debt of gratitude.
"For the last 10 years she has served as deputy director general and director general of the security service, leading the service through a time of significant change and growth.
"Her contribution to the security of our nation has been invaluable and I pay tribute to her unstinting efforts on our behalf."