Pakistan’s military launched a major ground offensive in the northwestern part of the country Monday, beginning what army commanders say will be a “house-to-house search” for terrorist leaders and other militants.

The offensive began after two weeks of airstrikes in North Waziristan, which has been a key sanctuary for the Pakistani Taliban and other militant groups, such as the Haqqani network. Al-Qaeda leader Ayman al-Zawahiri also may be hiding in the area.

In a statement, Pakistan’s military said its soldiers discovered “underground tunnels” and “preparation factories” for explosives during the initial hours of the ground assault.

Backed by artillery and tanks, troops killed 17 terrorists Monday, the army said. Combined with the toll from airstrikes that began June 16, a total of 376 terrorists have died in the offensive, the army said.

It is difficult to independently verify the army’s statements because foreign journalists are barred from traveling to the area.

More than a half-million residents fled North Waziristan ahead of the ground offensive. The mass evacuation of the area, which has a population of about 600,000, was intended to limit civilian casualties during the operation. The military also set up checkpoints in the area to trap militants.

The scale of the exodus has alarmed humanitarian groups, which have questioned whether Pakistan has enough resources to properly care for displaced residents.

The exodus is also raising questions about whether the slow ramp-up in the fighting gave terrorists time to escape. Pakistan’s northwestern tribal areas share a porous, mountainous border with Afghanistan.

For years, efforts to control terrorism in both countries have been complicated by the militants’ ability to cross the border easily.

When Pakistani Prime Minister Nawaz Sharif launched the offensive two weeks ago, he personally appealed to Afghan President Hamid Karzai to bolster security on the border to prevent militants from escaping into Afghanistan. Pakistani Taliban leader Maulana Fazlullah is thought to live in Afghanistan.

But relations between Pakistan and Afghanistan remain tense amid accusations of cross-border shelling and intrusions by intelligence officials.

On Friday, Karzai’s national security adviser, Rangin Dadfar Spanta, traveled to Islamabad with a letter from Karzai to Sharif.

In it, Karzai set a series of conditions for regional cooperation on anti-terrorism efforts.

He demanded that Pakistan release an unspecified number of Afghan Taliban leaders being held in Pakistani prisons. Karzai is hopeful that such a release could jump-start his effort to reach a peace agreement with the Afghan Taliban.

Karzai also said he wants assurances that no civilians will be harmed in the operation and that Pakistan will target “all terrorists without discrimination.”

And in one condition likely to be the most problematic for regional cooperation, Karzai said Afghanistan would partner with Pakistan only as part of a broader alliance that also included China and India, Pakistan’s longtime rival.

Mohammad Sharif in Kabul contributed to this report.