KABUL, Afghanistan — At least 40 staff members in Afghanistan’s presidential palace have tested positive for Covid-19, Afghan officials said on Sunday, forcing President Ashraf Ghani to isolate himself and manage the country’s response to the virus — amid a raging war — largely via video conference.

There is no evidence that Mr. Ghani himself is infected. His spokesman would not comment on whether the president had been tested.

But the reach of the virus deep into the center of Afghan power, guarded behind several layers of security to protect against truck bombings and suicide assaults, was a troubling omen of difficult times ahead. Officials are grappling with the spread of the disease and its economic ramifications for the impoverished nation even as they fend off Taliban onslaughts.

An official at the palace said that most of the 40 people who tested positive work for the administrative wing of the president’s office, the National Security Council and the office of Mr. Ghani’s chief of staff. A second senior official confirmed that dozens had tested positive after hundreds of palace workers were tested more than a week ago. The official did not provide further details, but said those with confirmed infections were sent into quarantine.