SAN JOSE — After a tumultuous four years, the president of San Jose State announced Monday he is leaving his post next month to serve as chief adviser to the president of Afghanistan, his home country.

Mohammad Qayoumi, 63, took over as university president in 2011 with an ambitious agenda to improve San Jose State’s profile within Silicon Valley’s technology community and lead the school into a new era of online learning. But he was often criticized as a “top-down manager” and questioned over his handling of a string of campus scandals, from the bullying of an African-American student in the dorms to his awarding Cisco Systems a $28 million contract to upgrade technology on campus without seeking competing bids.

A number of faculty and community leaders said they were surprised but not shocked by Qayoumi’s resignation. He is the fifth SJSU president to leave in 12 years.

“He has been under the gun almost since the day he arrived,” when he set an agenda to ramp up the university’s offering of online courses, a prickly change for faculty, said Larry Gerston, political science professor emeritus at San Jose State. “It’s just a bad combination of bringing someone into a place with bad morale who really didn’t gain trust and only added through his actions or inaction to the friction.”

Qayoumi’s international background, impressive education credentials and bootstrap engineering and academic career made him a fascinating choice to lead San Jose State, a mostly commuter campus struggling with overcrowding, funding shortages and aging infrastructure.

The son of a construction worker who left Afghanistan when he was 18, Qayoumi earned four master’s degrees in engineering, mostly while working full-time jobs. He has served in leadership roles in the Cal State system for 27 years, including as president of Cal State East Bay from 2006 to 2011.

Andrew Hsu, dean of SJSU’s Charles W. Davidson College of Engineering, said the president’s drive to increase the university’s connections with the tech industry was what propelled Hsu to come to SJSU.

“He’s in touch with many industry leaders in the Silicon Valley, and he helped me establish a lot of the connections that I have,” Hsu said.

In a statement Monday, Qayoumi said he considered his tenure at SJSU a “privilege” and that he and his wife Najia “will depart San Jose with many fond memories and the certainty that we are making the right choice at this time in our lives.”

Since 2002, Qayoumi said, he has often been asked to “lend my intellectual and operational expertise to many of Afghanistan’s significant economic, educational and infrastructure initiatives.” He has agreed to serve as Afghan President Ashraf Ghani’s chief adviser for infrastructure and technology.

His last day as San Jose State president is Aug. 17. No announcement has been made about an interim president or the search for a new one.

CSU Chancellor Timothy P. White praised Qayoumi for “leaving the campus with a solid fiscal foundation and proud legacy of achievements. His laser focus on innovation, coupled with his tireless work in expanding the visibility of the campus within the technology sector, have advanced the campus’ stronghold in the region as a leading provider of STEM (science, technology, engineering and math) graduates.”

But Qayoumi struggled to gain the respect of the SJSU faculty, many of whom were suspicious of his efforts to shift courses online while keeping close ties with valley giants.

Animosity only worsened when news broke in 2012 that Qayoumi’s office set up a $28 million deal with Cisco, a major university donor, to upgrade technology throughout the campus without seeking competitive bids. Many of the upgrades, including videoconference capabilities for class lectures, were meant to “reinvent teaching, learning and educational delivery systems” but years later were still unused by most of the faculty.

In 2013, Qayoumi’s leadership came under scrutiny again when the parents of an African-American freshman filed a complaint saying their son had been tormented by his white roommates in the dorm. The roommates had hung a Confederate flag in the shared suite and forcibly latched a u-shaped metal bike lock around the freshman’s neck.

Qayoumi was out of the country at the time of the incident and instead of rushing back, left the angry protesters and unsettled student body in the hands of his top aides.

It took five weeks before a decision was made to suspend the bullies.

“When the response is a delayed one, the message is that the particular conduct is really not so bad,” former Santa Clara County Judge LaDoris Cordell wrote in her report for a task force on campus race relations that Qayoumi established after the uproar.

“I found him to be a very nice person, very polite, very respectful,” Cordell said Monday in an interview. “But it almost felt to me he was a deer caught in the headlights. I didn’t get a sense that he was someone out in front, got it and knew what to do.”

Keith Barnes, a director with the Tower Foundation that raises money for the university, said Qayoumi did good work during a difficult time.

“Simply being able to navigate the political waters in the Cal State system when the system has been under so much pressure is difficult,” Barnes said. “I think it’s been a difficult job for him, but he’s maintained a good approach toward people and did it with dignity.”

Contact Julia Prodis Sulek at 408-278-3409. Follow her at Twitter.com/juliasulek.