Seven years ago, Janet Napolitano charged into the top office of the nation’s top public research university system with big ideas, a resume of powerful jobs and weighty political connections — including then-President Obama, who had appointed her as U.S. Homeland Security secretary.

But the new University of California president had no experience in academic leadership. Her top-down managerial style annoyed many chancellors and faculty leaders. Students protested her record as “deporter in chief” under Obama. She struggled to manage political relations in Sacramento, although the Board of Regents hired her in part to improve them.

And midway through her tenure, scandal erupted over interference by Napolitano’s aides in a state audit into her office’s operations.

But that low point in 2017 marked the start of a major reset.

As Napolitano prepares to step down Aug. 1, she leaves with a better ending than beginning, as fans and foes largely agree that she learned from her mistakes. They credit her with championing immigrant students and survivors of sexual misconduct, pushing forward initiatives on climate change and opening the UC system to many more California students.

“What I saw over time was the transition to a much more effective leadership model by the office of the president,” said UCLA Chancellor Gene Block.

Rigel Robinson, a Berkeley City Council member who was a student activist at UC Berkeley during Napolitano’s tenure, said her unprecedented outreach to students changed his mind about her.

“I was one of those students in 2014 who called for her removal and chanted, ‘Dammit, Janet,’ ” he said. “But now, after seven years, I’m sad to see her go.”

Napolitano, for her part, acknowledged the transformative impact of the scandal’s fallout.

“When you make a mistake, you have to acknowledge it; you have to fix it and own it,” she said in an interview last week. “What came out of that was there was a better understanding by me of the desire for more consultation and participation by different stakeholders in decisions as they were being made, as opposed to being announced. That, frankly, is a different style of leadership than I was used to.

“I think I was called upon to make that adjustment, and I think I made it, and we continue to move the university forward.”

Regents are planning to select Napolitano’s successor before she steps down.

Napolitano, 62, was an unconventional choice to head the most complex university system in the nation — a $39.8-billion operation of 10 campuses, five medical centers, three national laboratories and global research.

At the time, the UC system was being pummeled by financial pressures and political criticism that its costs were too high and its admission policies skewed in favor of out-of-state students over Californians.

Regents hoped Napolitano’s national stature, fresh perspective and political skills as a successful Democratic governor in the red state of Arizona would help UC find a way forward, said Regent Sherry Lansing, who headed the search committee at the time.

Napolitano, who assumed office in September 2013, took an initial listening tour at the campuses. The visits helped her set early priorities: increase access to a UC education and harness the campuses’ enormous brainpower into a systemwide effort to address sweeping issues.

She translated those ideas into quick action. That October, in her first major speech, she announced $15 million in funding to support students who are in the country illegally and those pursuing graduate degrees and postdoctoral research opportunities.

The next month, Napolitano announced initiatives to increase the number of California community college students transferring to UC, speed the development of UC research into profitable products and make the UC system a net-zero energy user by 2025.

Napolitano called climate change “the existential issue of our time.” The efforts, she said, have produced research on scalable solutions to climate change and an online curriculum; UC also has purchased solar farms outside Fresno and its own electric utility plant, which supplies renewable energy to several campuses.

But some of her initiatives, while praised for good intentions, caused consternation. Many campus leaders and faculty members complained that Napolitano failed to consult them, encroaching on work already being done.

Still, Napolitano’s vision and energy inspired some UC members.

“The University of California has these extraordinary individual campuses doing world-class research,” said Monica Lozano, a former board chair. “How do you take the collective strength of these institutions and mold them into something that benefits society at a much higher scale? She was able to do that in ways I hadn’t seen other presidents do.”

Napolitano’s political troubles began in 2014, when she proposed a five-year plan to increase tuition to provide more funds if Sacramento failed to do so. The proposal angered Gov. Jerry Brown and other state political leaders who served as ex officio regents and opposed the tuition plan. A board majority, however, passed it. After that, Brown zeroed out a planned funding increase for UC, and the battle was on.

Brown and Napolitano subsequently formed their so-called Committee of Two to hash out a compromise and ultimately agreed on a multiyear plan for funding increases in exchange for a two-year tuition freeze and other items.

From a national standpoint, Napolitano’s leadership appeared to help California outperform many other states in increasing funding for higher education after the 2008 recession, according to Ted Mitchell, president of the American Council on Education.

“She made clear that the University of California was a long-term treasure in the state and underfunding it would jeopardize the university and the state,” he said.

Napolitano was circumspect about her negotiations with Brown, who declined to comment.

“I think it’s fair to say we did not see eye to eye on everything,” she said.

Her worst moments came in 2017, when a state audit found that her office had not only amassed a $175-million undisclosed surplus but had also interfered with efforts by auditors surveying campuses about Napolitano’s office services. State Auditor Elaine Howle said she found “nothing nefarious” in the amassed surplus but offered several recommendations to make the budget more transparent, which the university has adopted.

At the time, Napolitano was battling more than fallout over the audit; she had a recurrence of cancer in 2016 that led to grueling sessions of chemotherapy and radiation, sometimes six hours long.

“2016-17 was not a good year for me,” Napolitano said, managing a laugh. “Sometimes it was very tough. But I am totally clear now” of cancer.

Napolitano’s troubles marked a major turning point. After the audit scandal, she apologized and became more consultative — deepening ties with, for instance, the Academic Senate by agreeing to appoint a faculty advisor, include the provost in all major decisions and invite Senate leadership into her advisory group.

“In the last two years, she was a much more successful and effective president than she had been before,” said Robert May, a UC Davis professor and former Senate chair.

Assemblyman Kevin McCarty (D-Sacramento), one of the more critical legislators on UC issues, credited Napolitano with “weathering the storm” and moving forward. “We were able to work together to dramatically expand enrollment of California kids,” he said. “That’s the issue my constituents care about most.”

Napolitano is widely praised for her support of undocumented students, including start-up funding for free legal services. She and the Board of Regents also filed the nation’s first lawsuit challenging the Trump administration’s efforts to end protections for students brought to the country illegally as children, granted under a program known as Deferred Action for Childhood Arrivals — which Napolitano started as Homeland Security secretary.

Napolitano has not won over all undocumented students. But UC Student Assn. President Varsha Sarveshwar said Napolitano has set a new standard in access to students, as the first president to hold regular meetings with them.

Napolitano also made a mark in directing efforts to overhaul the UC system’s Title IX processes and crafting a compromise plan to phase out the SAT and ACT, which regents unanimously passed last month amid criticism that the tests are biased against disadvantaged students.

“She’s been an extraordinary leader,” Lansing said. “She’s unflappable. She’s thoughtful. She listens to both sides, but then she’s decisive and gets things done.”

Despite the at-times rocky road, Napolitano said the ride has been well worth it.

“The position of president of the University of California is a great platform to address some of the larger public issues of the day, from DACA to climate change to sexual harassment to racism,” she said. “It’s a tough job and a complicated job, but I’m very glad I took it.”

Napolitano plans to take a yearlong sabbatical, then join the UC Berkeley Goldman School of Public Policy. She has not ruled out a run for political office, a Cabinet post — or an appointment to the U.S. Supreme Court.

“I look good in black,” she joked.