* Rare show of unity between two Taliban groups
* Collaboration raises risk of more Afghan violence
* Afghan interior minister pledges safe election
* Attacks on rise in buildup to key milestones
By Katharine Houreld
KABUL, March 27 (Reuters) - The Taliban in Afghanistan and Pakistan have secretly agreed to focus on carrying out operations in Afghanistan, with Pakistani militants announcing a ceasefire with their government in order to preserve militant bases used to stage cross-border attacks.
The collaboration between the two Talibans, revealed to Reuters by militant chiefs and security officials in the region, increases the risk that violence will escalate further in a crucial year for Afghanistan.
The nation of 30 million people holds a presidential election on April 5, a litmus test for foreign donors hesitant about bankrolling the government after the bulk of NATO troops stationed in Afghanistan withdraw this year.
The Pakistani and Afghan Taliban are closely allied and both aim to impose a strict form of Islam on their societies.
But their leadership and targets differ. The Pakistani Taliban focus their attacks in Pakistan, while the Afghan Taliban focus on Afghan and NATO security forces and anyone allied to them.
A rash of Taliban attacks this month has already raised concerns about the credibility of the poll, which should mark the first democratic transfer of power in war-ravaged Afghanistan.
Most foreign observers withdrew their monitors after a deadly attack on a hotel in the heart of the capital, increasing the risk of the widespread fraud that marred the last presidential election in 2009.
A large number of voters may also be too scared to cast their ballot.
Afghanistan's interior minister said this week that the one-month ceasefire announced by the Pakistan Taliban on March 1 to revive peace talks with the government in Islamabad had prompted militants there to switch focus from home soil to Afghanistan.
"From the day there was a ceasefire on that side, almost every night one or other of our border posts has been attacked by people from the other side of the border," Umer Daudzai told Reuters.
The ceasefire was urged on the Pakistani Taliban by the hardline Haqqani network and the Afghan Taliban, who are based around the mountainous border between the two countries, militant commanders and a security source said.
They feared the threat of an offensive by the Pakistani military could hamper their own push to carry out attacks in Afghanistan, including on election officials and NATO forces.
Peace talks between Islamabad and the Pakistan Taliban began in February, but broke down when the militants bombed a police bus and executed 23 paramilitary troops.
The Pakistani military then launched air strikes and said it was preparing to storm militant sanctuaries in North Waziristan, a border region that is a militant stronghold. But the operation was put on hold after the Pakistan Taliban announced the truce.
The revelations suggest that the ceasefire may have been a smokescreen to give the Pakistani militants a chance to regroup and also work with the Afghan Taliban and Haqqanis to ramp up attacks in Afghanistan ahead of the election.
"We need to focus on Afghanistan," one Taliban commander told Reuters. "It is a very crucial time for us and if the North Waziristan operation goes ahead we will lose many of our fighters."
The Pakistani security forces and government did not respond to requests for comment.
Pakistani Defence Minister Khawaja Asif told Reuters this month that the government was worried about the possibility of increasing convergence between the two Talibans.
"Then the (Pakistani Taliban) will have a powerhouse behind them," he said.
This week Pakistan's National Security Council was told in a briefing that plans had been hatched in Islamic religious schools to disrupt the poll in neighbouring Afghanistan, an Islamabad-based security official said.
The shadowy Haqqani network, which is blamed for some of the deadliest and most sophisticated attacks in Afghanistan, was at the heart of the ceasefire plan, sources said.
Shortly after the peace talks collapsed in February, Pakistani politicians approached Haqqani commanders and asked them to help broker a ceasefire, two Taliban chiefs and two Kabul-based officials said.
"I'm sure of the involvement of the Haqqanis and Quetta Shura in these (ceasefire) talks," said a high-ranking Afghan government official with extensive contacts with the insurgency. The Quetta Shura is the leadership of the Afghan Taliban.
The Pakistani Taliban initially rebuffed the Haqqanis, who then asked senior members of the Afghan Taliban to help persuade their Pakistani counterparts to announce the truce. It worked, Taliban commanders said.
The police chief of the eastern Afghan province of Kunar, which lies on the border with Pakistan, said there was no doubt Taliban militants were crossing into Afghanistan.
"It is too early to say how the peace talks in Pakistan would affect this side, but insurgents there are crossing the border to disrupt the election," Abdul Habib Sayedkhil told Reuters. "We are prepared and have certain measures in place to tackle it." (Additional reporting by Mehreen Zahra-Malik in ISLAMABAD and Mohammad Anwar in KUNAR, Afghanistan; Editing by John Chalmers and Mike Collett-White)