An accidental keystroke has thrown off Prince William’s budget by $5 million, meaning county leaders will need to dig for savings during the spending year that began Monday, county officials said.

Budget officials realized June 24 that they did not have enough money to pay for expected expenditures, said Jason Grant, a county spokesman.

The error occurred when a county staffer inadvertently typed in the wrong year — fiscal 2012 instead of fiscal 2013 — in a code that projects the payroll budget, officials said.

Supervisors haggled at length over cuts big and small before they settled in April, with a 5 to 3 vote, on a $961.5 million budget plan. Because of the error, that budget is projected to come up $5 million short.

Grant said the county wants to make clear that it is not as if millions of dollars were spent from county coffers accidentally. “It is not a revenue error or expenditure error,” he said.

He said he does not expect layoffs. Grant said he thinks officials will be able to find savings as this budget year continues.

Board Chairman Corey A. Stewart (R-At Large) said supervisors have asked internal auditors to examine the error and assure it does not happen again. “We need to make sure we fix the problem instead of affixing blame,” he said.

Stewart laid out four options: cutting the budget, using one-time dollars carried over from last year, allocating savings from refinancing long-term debt and finding dollars as the year goes along. He said the board may agree to a combination of fixes.

“We’re going to have to piece it together,” he said. “It’s a lot of money, but it’s not insurmountable.”

In an e-mail to supervisors, County Executive Melissa S. Peacor attributed the mistake to “human error with absolutely no malice involved.” “The staff involved are some of the best and the brightest we have. . . . I take full responsibility on the part of the staff involved,” she wrote.

Supervisor W.S. Covington III (R-Brentsville) said supervisors must take responsibility, as well. “We have a certain level of responsibility to see these things and understand the budget,” he said.

Covington said supervisors expect McGladrey, the firm contracted for its internal auditing work, to have completed an investigation when the board discusses the matter July 16.