Ghani's remarks, made at an international conference in the northern Indian city of Amritsar not far from the border with Pakistan, suggested tensions were rising with Pakistan after Ghani attempted to improve relations with Islamabad when he took office in 2014.
Size of Delhi, Kabul missions fails to lift ties
Pakistan said while violence had increased in Afghanistan , blaming another country for it didn't help.
Violence has spread around Afghanistan and the Taliban's ability to conduct coordinated high profile attacks in the capital Kabul has piled pressure on Ghani's Western-backed government to provide better security to a war weary people.
Last year, Afghanistan suffered the highest number of civilian casualties and military related deaths in the world, Ghani told the Heart of Asia conference aimed at getting regional players together to help stabilise his country.
"This is unacceptable... Some still provide sanctuary for terrorists. As a Taliban figure said recently, if they had no sanctuary in Pakistan, they wouldn't last a month," he said.
Analysts say Pakistan has historically backed the Afghan Taliban as a hedge against the influence of arch-rival India, with whom Pakistan has fought three wars, in its backyard.
Pakistan denies this and instead said it is itself a victim of terrorism and that fighters of the Tehreek-e-Taliban, one of the main groups carrying out attacks inside Pakistan, were operating from Afghanistan.
Pak-Afghan relations and reprisals
Sartaj Aziz, Pakistan's top foreign policy adviser, said it was true that there had been an upsurge in violence in Afghanistan. "We need to have an objective and holistic view rather to blame one country," he told the conference.
The number of people displaced by conflict in Afghanistan this year has surpassed half a million people, the United Nations reported last month, the highest number since it began compiling such statistics in 2008.
On top of the Taliban, Islamic State has claimed responsibility for attacks targeting minority Shias in Afghanistan where sectarian violence has been rare.
Ghani said there were 30 militant groups identified by the UN that were trying to establish a base in Afghanistan.
"I don't want a blame game, I want clarifications on what is being done to prevent the export of terror," Ghani said, calling it an undeclared war on Afghanistan.
"We thank Pakistan for their pledge of $500 million assistance for reconstruction of Afghanistan. I hope you use it to fight terrorists and extremists in Pakistan." Pakistan had made the pledge earlier this year.
Pakistan's hand in the rise of international jihad
Ghani's remarks, the strongest in recent months, come as India has simultaneously mounted pressure on Pakistan to end what it too calls cross-border terrorism in the disputed territory of Kashmir.
Prime Minister Narendra Modi said regional players had to act against not only the militants but their sponsors. "It must be backed by resolute action. Not just against forces of terrorism, but also against those who support, shelter, train and finance them."
Islamabad has rejected the Indian allegations and said it was ready to hold talks with India on the dispute over Kashmir, but no talks are planned with Aziz while he is in Amritsar, Indian officials said.
COMMENTS (22)
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ