WASHINGTON — Defense Secretary Chuck Hagel made a surprise announcement on Saturday that he would recall next week almost all of the 400,000 civilian employees of the Defense Department who had been sent home when the government shut down.

Mr. Hagel said the decision that “most D.O.D. civilians” would now be exempted from furloughs came after Pentagon and Justice Department lawyers interpreted a budget law passed just before the shutdown to include a larger number of workers.

When the government shut down, about half of the Defense Department’s civilian work force of 800,000 was ordered to stay home; military personnel are automatically exempted from the shutdown.