WASHINGTON — Eric Shinseki resigned as secretary of veterans affairs Friday, apologizing for a scandal in which employees throughout the VA’s massive hospital system conspired to hide months-long wait times that veterans faced when seeking care.

The size and scope of the cover-ups in an agency that he had presided over for more than five years left Shinseki dumbfounded and President Obama searching for a replacement for one of his longest-serving and most trusted Cabinet officials. Obama said Sloan Gibson, the deputy secretary of veterans affairs, will take over the VA until a new secretary is named.

In announcing Shinseki’s resignation, Obama went out of his way to describe the former Army general as a person of integrity who presided over a bureaucracy that was overwhelmed by two long wars and an aging veteran population, and which ultimately succumbed to widespread cheating to hide its shortcomings.

“I want to reiterate, he is a very good man,” the president said. “I don’t just mean that he’s an accomplished man. I don’t just mean that he’s been an outstanding soldier. He’s a good person, who’s done exemplary work on our behalf.”

Obama, however, concluded that the growing calls for Shinseki’s firing had become too much of a distraction from the complicated work of fixing the troubled department.

The problems surrounding long wait times for care – and VA employees’ attempts to cover them up – have been around for years, detailed in more than 18 watchdog reports dating back to 2000. The latest, and most damning, review was released this week by the VA inspector general and immediately spurred the wave of bipartisan calls for Shinseki’s ouster. Shinseki himself seemed stunned by the report’s conclusion that he had, for the last five years, been presiding over a deeply flawed and dishonest bureaucracy.

“I can’t explain the lack of integrity among some of the leaders of our healthcare facilities,” Shinseki said shortly before he quit his post. “This is something I rarely encountered during my 38 years in uniform. I cannot defend it because it is indefensible. But I can take responsibility for it, and I do.”

Shinseki’s fall at the VA was triggered by a confluence of problems including poor leadership at VA hospitals, woefully dated technology and a health-care system that couldn’t handle the strain caused by almost 13 years of war and Vietnam veterans who were using the system in greater numbers, according to his former top aides. Shinseki’s forced resignation amid dwindling political support raises a difficult question for the Obama administration: Can anyone reform an agency that, as the president acknowledged Friday, had been dogged by management and funding problems for a “very long” time?

Soon after he took over the VA in 2009, Shinseki tried to improve the leadership culture by meeting quarterly with every hospital director in the agency’s giant network, sometimes for hours. “It was months and months and months . . . every single day getting a personal read,” said Rep. Tammy Duckworth, D-Ill., who worked for Shinseki at the VA. “No other secretary had ever done that.”

The former Army general, who lost half of his right foot to a mine in Vietnam, also pushed for more education and training, similar to the kind the Army had instituted in the 1970s when it wrestled with widespread discipline problems, mistrust and dissent in its own ranks. Neither of those efforts was enough to ensure that managers – seeking performance bonuses and promotions – were willing to acknowledge the problems inside VA’s healthcare system, which grew worse over the last five years as more than 2 million patients were added to the rolls.

“As Ric Shinseki himself indicated, there is a need for a change in culture within the (Veterans Health Administration) and perhaps the VA as a whole to make sure that bad news gets surfaced quickly so things can be fixed,” Obama said.

John Gingrich, Shinseki’s chief of staff until 2012, summed up the problem in even starker terms: “When people don’t have integrity, it is hard to transform them.”

Shinseki also struggled to update the VA’s electronic scheduling systems, some of which had been in place since the 1980s. The aging system made it difficult for low-level employees to track patients and made it almost impossible for top VA officials in Washington to get reliable data on how long veterans were waiting for care. The president Friday described these technology problems as “eminently fixable.”

Plans to build a new scheduling system, however, have been on the books for more than 14 years and have languished because of a lack of funding and the need to address more pressing needs within the overburdened VA system. “It’s a simple question of bandwidth and priorities,” said Peter Levin, a former senior technology adviser to Shinseki at the VA.

As the strain on the system and mid-level VA managers mounted, a culture of cheating and lying took hold within the department, former officials said.

Some lawmakers said that Shinseki’s lack of political and media savvy had made it harder for him to survive the steady stream of scandals and problems that had hit the VA as the number of veterans seeking healthcare and disability swelled.

“He is not what you call a modern media guy,” said Sen. Bernie Sanders, I-Vt. “He’s not the kind of guy who can get out and give a five-second sound bite.. He does that very poorly, . . . he just doesn’t like to do that. That’s just the way he is.”