KABUL (Reuters) - The Taliban on Monday directed Afghans to boycott upcoming parliamentary elections and demanded a complete withdrawal of foreign forces as the only solution to end the 17-year-old war as they ramped up attacks in strategic provinces.

FILE PHOTO: Election posters of parliamentarian candidates are installed during the elections campaign in Kabul, Afghanistan September 30, 2018. REUTERS/Omar Sobhani

The statement from the hardline Islamic militant group coincided with the visit of top U.S. envoy Zalmay Khalilzad, who has been appointed to lead peace efforts with the Taliban.

Khalilzad met President Ashraf Ghani in Kabul to discuss ways to hold Afghan-led peace talks with the Taliban, whose 1996-2001 rule was ended by U.S.-led troops.

“Peace is a holy process, and the U.S. government and people are united with the Afghan government and people in this process,” Khalilzad was quoted by Ghani’s office in a statement as saying.

Khalilzad, an Afghan-born former U.S. ambassador to Afghanistan and Iraq, joined the U.S. State Department team in September.

He is scheduled to visit Pakistan, the United Arab Emirates, Saudi Arabia and Qatar this week as he seeks to bring the Taliban to the negotiating table.

But the Taliban, who are fighting to expel foreign forces, topple the government and restore their version of hardline Islamic law, have repeatedly rejected offers to hold peace talks or support the polls.

The Oct. 20 vote, seen by international partners as a dry run for presidential elections next year, has been hampered by chaotic preparations, allegations of fraud and ever-present fears of militant violence.

Zabihullah Mujahid, the Taliban’s main spokesman, said the United States was using the elections for the sole purpose of legitimizing their presence and authority.

“People are given a deceptive feeling of having free right casting their votes for the malicious purpose of minimizing their resentment against the foreign occupation,” he said.

With less than two weeks to go before the long-delayed elections, the Taliban and Islamic State have stepped up attacks across the country.

On Monday a ministry of defense statement said Afghan forces had killed more than 120 Taliban fighters and other militants during 20 operations, including 17 air strikes in various parts of the country.

More than 30 Taliban fighters were wounded in air strikes conducted in Ghazni, Kandahar, Farah and Faryab provinces.

The fighting has underlined the struggle security forces face as the insurgents have steadily extended their control over the countryside even though they have been unable to take and hold a major city.

“The real solution of the ongoing Afghan crisis lies in the complete withdrawal of all foreign occupying forces and the restoration of a pure Islamic sovereignty,” said Mujahid.

Western diplomats have said the fighting raises questions about the viability of the U.S. strategy to end the war, which for the past year has focused on forcing the militants, largely with more air strikes, to the negotiating table.