The director of California’s state parks system resigned after officials discovered that her department had $54 million of unspent money in its accounts that it had not reported to the Department of Finance, even while the state said parks were so short of money that many needed to be closed.

The Associated Press reported that Ruth Coleman, who had led the agency since 2003, stepped down, and the department’s second-in-command, Acting Chief Deputy Director Michael Harris, was fired.

California Natural Resources Secretary John Laird said the state Attorney General’s Office will be investigating and the Department of Finance will be conducting a comprehensive audit.

“It’s our goal to make sure we get to the bottom of this,” Laird said.

Laird said that the parks department had shielded from finance officials $20.4 million in an account that takes money from park entrance fees and concession contracts, as well as $33.5 million in a state fund for off-highway vehicle parks.

The disclosure comes at a politically difficult time for Gov. Jerry Brown, who pushed for more than a year to close 70 state parks — one quarter of the entire park system — to save $22 million as part of efforts to balance the state’s budget.

“This is deeply disappointing because we just went to many partners around the state to get them to step up and cover the shortfall,” Laird said. “I’m truly sorry about that.”

The parks had been scheduled to close on July 1. But they didn’t after dozens of private groups, cities and private companies came forward with donations.