Afghan President Ashraf Ghani has said his government is open to peace talks with armed groups who accept peace but said the door was closed to those who cause tragedies like recent attacks in the capital, Kabul.
Two attacks in Kabul that left scores of civilians dead were claimed by Taliban.
An attack on the Inter-Continental Hotel in Kabul on January 20 and a massive car bombing on a crowded city street a week later have stoked public anger and stepped up pressure on Ghani's Western-backed government to improve security.
The two attack killed more than 130 people. The recent attacks have raised fresh doubt about long-running efforts to initiate talks with the armed fighters.
The president's office said on Tuesday the fighters had crossed a "red line" and peace would have to be won on the battlefield.
But Ghani raised the possibility of reconciliation with some factions of Taliban in a speech in Kabul.
"Those who are responsible for this tragedy and do not want peace, the door of peace is closed to them," Ghani said.
"Those who accept peace, they will witness that the nation will embrace them. But there is a clear difference, our commitment to bringing peace does not mean we will sit quietly and won't retaliate."
"We will dig them out from any hiding holes."
Afghanistan's government has made such vows for years, but the rebellion appears ever more resilient. Peace efforts have been made in fits and starts but without progress.
US President Donald Trump appeared to dash any hope for peace efforts on Monday when he condemned the Taliban for the Kabul violence and rejected the idea of talks.
Trump last year ordered an increase in US troops, air raids and other assistance to Afghan forces, to force the Taliban to join peace talks.
But his comments on Monday suggested he saw a military victory over the Taliban, an outcome that US military and diplomatic officials said could not be achieved with the resources and manpower he had authorised.
US Deputy Secretary of State John Sullivan said in Kabul on Tuesday the US strategy had not changed and the aim was still to press the Taliban militarily to convince them that they had to negotiate.
The Taliban want foreign troops to leave Afghanistan and re-establish their form of strict Islamic law.
Afghanistan has long accused neighbouring Pakistan of failing to act against Taliban plotting violence from safe havens on the Pakistani side of the border.
On Friday, Ghani accused Pakistan of being the "Taliban centre" and said he was waiting for Pakistani action.
Pakistan denies helping the Taliban and a Pakistani delegation led by Foreign Secretary Tehmina Janjua visited Kabul on Saturday with the aim of fostering cooperation. Janjua called for both sides to stop the "blame game", Pakistani media reported.
The United States said last month it would cut security aid to Pakistan, complaining it was not doing enough to combat fighters sheltering there.
Source: Reuters news agency