Janet Napolitano, who as President Obama’s homeland security secretary has one of the broadest and most challenging portfolios of any Cabinet member, announced Friday that she is stepping down to become president of the University of California system.

Napolitano has been a central figure in the debates over immigration and counterterrorism policies while also managing the government’s response to tornadoes, hurricanes and other natural disasters.

Her resignation comes at a critical time for the Obama administration, as Congress debates a controversial bill to overhaul the nation’s immigration laws. Napolitano’s departure has been in the works for several months, and she plans to leave her post in early September, according to two administration officials.

A former governor of Arizona and a Democrat once seen as a potential candidate for national office, Napolitano, 55, will exit the political stage to run one of the country’s largest public university systems.

In a statement released Friday morning, she said that serving in the Obama administration to help protect Americans from harm “has been the highlight of my professional career.”

“We have worked together to minimize threats of all kinds to the American public,” she added.

In addition to being on the front lines in the politically charged immigration debate, Napolitano helped lead the responses to deadly tornadoes in the Midwest and Hurricane Sandy, which ravaged the Northeast last year, as well as the 2010 BP oil spill in the Gulf of Mexico and the H1N1 virus.

Some of her actions have come under scrutiny. Critics faulted her for playing a role in toughening airport security procedures, including through the introduction of full-body scanners. More recently, she was questioned by Congress on whether DHS agencies missed clues about the perpetrators of the Boston Marathon bombings.

Obama thanked Napolitano for her more than four years of service, saying, “Janet’s portfolio has included some of the toughest challenges facing our country.”

“The American people are safer and more secure thanks to Janet’s leadership in protecting our homeland against terrorist attacks,” Obama said in a statement. “I’ve come to rely on Janet’s judgment and advice, but I’ve also come to value her friendship.”

An early political backer of Obama’s who was sworn in as homeland security secretary in 2009 on the first day of his administration, Napolitano was among a handful of Cabinet officials to remain in their posts into his second term.

She had given no public indication that she would leave, although she was seen as a possible successor to Attorney General Eric H. Holder Jr. should he depart.

Administration officials said Napolitano, who had extensive law enforcement experience in Arizona, did not hide her desire to be attorney general and grew discouraged about her prospects as Holder stayed well into Obama’s second term.

One administration official familiar with Napolitano’s thinking cautioned that she simply seized what she considered to be a great career opportunity, calculating that after serving longer than any other homeland security secretary, it was time for a new challenge.

“The process was underway for some time, but it didn’t formalize until recently, and she informed the president when she made her decision,” said the official, who requested anonymity to speak about the process.

Republicans on Capitol Hill generally praised Napolitano’s tenure. Sen. John McCain said that his fellow Arizonan had “served our nation with honor” and that he had “never doubted her integrity, work ethic or commitment to our nation’s security.”

Who will replace her?

Administration officials declined to speculate immediately on a possible replacement, but they stressed that the position itself is a difficult one to fill.

DHS, created in the aftermath of the Sept. 11, 2001, terrorist attacks, is sprawling and complex, with 240,000 employees spread across 22 government agencies. It oversees issues ranging from the weather to natural disasters to airport and border security to drug interdiction to protection of the president.

Both Obama and President George W. Bush tapped governors — who manage sprawling bureaucracies in their own states and must develop expertise across a range of issues — to head the department.

In Napolitano’s case, she came into the job with a law enforcement background as a former state attorney general and U.S. attorney, as well as experience administering a large government and grappling with immigration issues at Arizona’s border with Mexico.

Douglas B. Wilson, a top Pentagon official during Obama’s first term, said Napolitano’s legacy will be revamping the once-troubled Federal Emergency Management Agency and managing the 21 other disparate agencies that fell under her control.

“In an organization that faces drama every day, she was a no-drama leader,” said Wilson, a longtime friend.

“She is very, very good at taking combinations of individual fiefdoms and playing to their strength to get the best out of them individually and making them into an effective collective.”

In seeking a replacement, Obama may try to avoid a contentious confirmation battle with the Senate at a time when he is pushing a controversial immigration bill.

Two DHS agency heads who maintain particularly good relations with congressional oversight agencies are seen as possible contenders:

W. Craig Fugate, the current FEMA administrator, previously worked for two Republican governors in Florida as the state’s emergency management director. Fugate is well-liked by the White House and has been credited with improving FEMA since Hurricane Katrina in 2005.

John S. Pistole, head of the Transportation Security Administration and a former deputy director of the FBI, has built good relations with Congress despite objections over recent proposed changes to screening procedures at airports.

If Obama wanted a seamless transition, he could tap Rand Beers, who has been Napolitano’s acting deputy, or Alejandro Mayorkas, a Cuban-born lawyer who ran the department’s Citizenship and Immigration Services and was recently nominated to become deputy DHS secretary.

Other potential replacements include former Navy secretary Richard Danzig, retired Coast Guard Adm. Thad W. Allen or New York City Police Commissioner Ray Kelly, whom Sen. Charles E. Schumer (D-N.Y.) personally recommended on Friday.

‘Remarkably gifted’

Napolitano will be the first woman to run the 10-campus University of California system, according to the Los Angeles Times, which first reported her appointment Friday morning.

Napolitano’s lack of an education background makes her an unusual pick to lead an academic institution. She has roots in California, though: As a student at Santa Clara University, she became the university’s first female valedictorian.

Sherry Lansing, a UC regent and former film industry executive who headed the search committee, said in a statement that “those who know her best say that a passion for education is in her DNA.”

Lansing described the search as “extensive,” saying the committee reviewed more than 300 potential nominees but that Napolitano was “a remarkably gifted candidate” and received a unanimous vote of recommendation from the committee.

“While some may consider her to be an unconventional choice, Secretary Napolitano is without a doubt the right person at the right time to lead this incredible university,” Lansing said.

Juliet Eilperin and Ed O’Keefe contributed to this report.