Updated

Afghanistan has reportedly reached a truce with Taliban militants in a remote province, a move meant to improve security ahead of the country's Aug. 20 presidential elections.

The ceasefire deal was reached Saturday in northwestern Badghis province, near the border with Turkmenistan, presidential spokesman Seyamak Herawi told Reuters — a move the government hopes to replicate in other parts of the country, he said.

"As long as the ceasefire holds, the government does not have the intention to attack the Taliban (in Badghis). And the Taliban can also take part in the elections," Herawi told Reuters.

Taliban violence has increased across Afghanistan this year, and U.S. troops have begun a major offensive in southern Helmand province, though Badghis province has seen fewer attacks and less activity.

Under the terms of the Afghan deal, the Taliban has agreed not to attack election candidates in their province and will allow the government to secure polling places.

The reported move came as President Hamid Karzai said Monday he would be willing to talk with Taliban leaders who publicly renounce violence and endorse peace.

But Karzai, acknowledging shaky relations with his international partners in the war on terror, told The Associated Press in an interview that he was not prepared at this time to discuss the key Taliban demand — a timetable for the withdrawal of all foreign troops.

Karzai said the presence of U.S. and international forces was in the Afghan national interest but should be "based on a new contract" that would minimize civilian casualties, limit searches of private homes and restrict detaining Afghans indefinitely without charge.

Meanwhile, a Taliban spokesman, Qari Yousef Ahmadi, rejected the idea of talks, saying the militants would not discuss a cease-fire with any government that was a "servant of the foreigners."

Karzai also said he wants the U.S.-run prison at Bagram Air Base, where about 600 Afghans are held, re-evaluated and inmates released unless there is evidence linking them to terrorist affiliation. He said arrests are turning ordinary Afghans against U.S. and NATO forces.

Karzai has promised to pursue those demands for changes in the relationship with foreign forces if he wins a second term in the Aug. 20 election. He is considered the leading contender in the 39-candidate field, though he would be forced into a runoff if he fails to win a majority of votes in the first round.

"The Afghan people still want a fundamentally strong relation with the United States," Karzai said. "The Afghan people want a strategic partnership with America" based on fighting Islamic extremism.

But he added that the partnership must ensure "that the partners are not losing their lives, their property, their dignity as a consequence of that partnership."

The 91,000 international troops based in Afghanistan include about 65,000 under NATO's International Security Assistance Force, or ISAF. The rest are part of a U.S.-led coalition involved in counterterrorism and training Afghan forces. Both groups operate under different rules, which are kept secret for operational security reasons.

It is widely assumed, however, that the U.S.-led counter-terror command enjoys broader powers to search homes and detain people indefinitely if they are suspected of posing a security threat.

Last month, the new U.S. and NATO commander, Gen. Stanley McChrystal, issued new orders saying troops may attack insurgents hiding in Afghan houses only if international forces are in imminent danger. The measures were put into effect to quell a storm of criticism from Karzai's government about civilian casualties, which help fuel the Taliban insurgency.

During his interview, Karzai suggested those measures may not be enough to convince most Afghans to accept a long-term international role, which he said was in the interest of the Afghan people.

Karzai said no Afghan mother would weep over a son killed or wounded in the war "but that Afghan mother would very much want her other son, her husband or her daughter to be safe in their homes, to be safe in their communities, not to be bombed, not to be arrested, not to have their homes broken into at night with their front gate blown up by dynamite."

Karzai also said he wanted a dialogue with Taliban members not affiliated with Al Qaeda or "in the grips of foreign intelligence agencies" in order to "reintegrate" them into Afghan society. He said those Taliban members must first repent "and announce that publicly."

He did not specify any foreign intelligence agency, but Afghan officials have in the past accused Pakistan of backing the Taliban, which Pakistan denies.

But Karzai also made clear he was not prepared to call for a timetable for the withdrawal of foreign forces, which some key Taliban figures have demanded before they will enter peace talks.

Karzai acknowledged strong differences over the years with the NATO and U.S.-led forces "but I also know and the Afghan people also know that the presence of international troops in Afghanistan is bringing stability to Afghanistan."

"I would advise the Taliban not to ask for the exit of international forces in Afghanistan because that is not in the interest of the Afghan people," he said.

Instead, both sides should work toward a relationship in which foreign troops show greater sensitivity to Afghan culture and the Afghans display "better management of governmental affairs."

Karzai has come under criticism for embracing some of Afghanistan's most notorious warlords, including his vice presidential running mate Mohammad Qasim Fahim, and his defense adviser, Gen. Rashid Dostum, who has been accused of killing hundreds of Taliban prisoners in 2001.

Karzai defended those ties, saying many of those now branded as warlords had received "million and millions of dollars" from the United States for their help in fighting the Taliban in the 2001 U.S.-led invasion.

The Associated Press cotnributed to this report.