By John Irish and Lamine Chikhi
PARIS/ALGIERS (Reuters) - Algeria has given its tacit approval for an Africa-led military intervention in northern Mali to rout Islamist militants despite reservations the operation could spill over into its territory and neighboring countries, Algerian and French sources said.
Africa's biggest country and a top oil and gas exporter shares a 2,000 km (1,242 mile) border with Mali and sees itself as the major regional power, wary of any outside interference.
It fears military action in Mali could push al Qaeda militants back into southern Algeria as well as triggering a refugee and political crisis, especially among displaced Malian Tuaregs heading north to join tribes in Algeria.
Although Algiers would not be able to veto an operation, it would be diplomatically risky for African countries backed by Western powers to intervene in Mali without Algeria's consent, especially as the conflict could drag on for many months.
However, after weeks of diplomatic cajoling led by former colonial power France, Algiers has now reluctantly agreed that foreign troops will be needed to eradicate the Islamist threat. It continues to rule out any direct support to the mission.
"At the end of the day, we won't oppose a military intervention in Mali as long as foreign troops are not stationed on our soil," an Algerian source informed about discussions on Mali said.
With six hostages held by the Islamists and fearful of an attack on home soil, France is eager for swift action.
"Algeria now accepts the principle of a military intervention, which wasn't the case before," a senior French diplomat said.
He said the change in position came after a high-level meeting in the Malian capital Bamako on October 19 that brought regional and international players to the negotiating table.
A French defense ministry source said there was "tacit" agreement and that Paris did not expect more from Algiers.
Algeria has repeatedly advocated a diplomatic solution in Mali since Tuareg rebels and Islamists captured two thirds of the country after an army coup in Bamako in March. The Islamist militants, some linked to al Qaeda, later hijacked the revolt.
The Bamako meeting followed a French-drafted U.N. Security Council resolution urging Mali to engage in dialogue with Tuareg Islamist rebels Ansar Dine if they cut links with radical groups, a move that satisfied Algiers' calls for dialogue.
Paris had until now considered Ansar Dine among the al Qaeda-linked groups and refused to negotiate with them.
The resolution also asked African states and the United Nations for a Mali military intervention plan within 45 days.
A second Algerian official said Algiers would do its best to find a diplomatic solution, but could also potentially support Malian troops by providing weapons for a future operation.
Diplomats say any intervention in the north is still some months away with a three-phased plan likely to consolidate the south of Mali first, followed by an operation to re-take northern cities and finally a mission to go after militants.
In anticipation, Algerian Prime Minister Abdelmalek Sellal told lawmakers extra troops had been sent to secure Algeria's borders.
"We won't allow any threat to harm our nation," he said. "Algeria wants to avoid having terrorist dens at its frontiers."
The change in Algeria's position comes amid an improvement in ties with France 50 years after it gained its independence.
In a symbolic gesture before a state visit to Algeria in December, President Francois Hollande acknowledged for the first time last week that Algerians were massacred at an independence rally in Paris in 1961. Historians say more than 200 may have been killed in the police action.
Four ministers, including the foreign minister and interior minister, have travelled to Algiers in recent weeks to pave the way for the trip aimed at normalizing relations and ensuring the visit is not clouded by differences over the Mali crisis.
"This changes things considerably for Hollande's trip. We are no longer at risk of a discord over Mali," said a French diplomatic source. "It's no longer the idea of a bellicose France demanding intervention and the Algerians saying never."
Riccardo Fabiani, North Africa analyst at Eurasia Group, said there was still a clear red line for Algeria which was that it would not intervene or commit troops.
"They are adopting a sort of benevolent neutrality. The Algerians are going to stand by and watch. I can't see collaboration at any level other than intelligence sharing."
(Writing by John Irish; Editing by Alistair Lyon)