* Sisi sees militants in Libya as major security threat
* Militants seek creation of caliphate in Egypt
* Egypt had considered cross-border offensive
SALLOUM, Egypt July 13 (Reuters) - A few days before he was elected Egypt's president in May, Abdel Fattah al-Sisi discreetly visited tribesmen living along the border with Libya. Tribal leaders there say Sisi, former head of the army, urged them to help Egypt confront what could be a security nightmare for the biggest Arab nation: Islamist militants operating just over the frontier in Libya.
"Sisi came to us and asked us to stand behind the security forces and army to help them to control the border because what is happening in Libya poses a grave danger to Egypt," said Mohamed al-Raghi, a tribal chief.
Wearing a flowing white robe and a traditional black cap outside a mosque in the border town of Salloum, Raghi said he and other tribal leaders had assured Sisi they would help him.
Chaos in Libya has allowed militants to set up makeshift training camps only a few kilometres from Egypt's border, according to Egyptian security officials.
The militants, those officials say, harbour ambitions similar to the al Qaeda breakaway group that has seized large swathes of Iraq; they want to topple Sisi and create a caliphate in Egypt.
A state security officer in Salloum said Egyptian authorities see a threat in Libya because of instability that stretches from the border to the town of Derna, an Islamist and al Qaeda hotspot a few hundred kilometres away.
"We know of three camps in the Libyan desert of Derna which are close to the Egyptian border where hundreds of militants are being trained," said a state security officer in Salloum.
The official is in charge of a unit that monitors militants through informants, including bedouins and agents who have penetrated the camps.
"Those militants are sympathetic to different organisations including the Islamic State (formerly known as the Islamic State of Iraq and the Levant). Others are Muslim Brotherhood fugitives who are on the run from death sentences they received in Egypt. They train on a daily basis in how to use weapons," he said.
The Brotherhood renounced violence decades ago and says it has no links to violent militant groups. Libyan officials denied the existence of camps, and U.S. sources said the Egyptians may be overestimating the scale of the threat.
However, Egyptian security officials believe the militants in Libya - who they say include Egyptians, Syrians, Palestinians and Afghans - are a serious threat to Egypt, a strategic U.S. ally that has a peace treaty with Israel and controls the Suez Canal waterway, a vital global shipping route.
While Egypt has put down internal insurgencies in the past, the threat from militants in Libya may prove more problematic. According to security sources, the men in Libya are trying to join forces with Egypt's most lethal militant group, Ansar Bayt al-Maqdis, which is based in the Sinai Peninsula on the other side of Egypt, near the border with Israel.
The Sinai insurgency has shown how even a small number of militants can mount a challenge to the Egyptian state . Ansar has killed hundreds of people in bombings and shootings and proved resilient in the face of army offensives. Yet Sinai residents say its core amounts to only a few hundred militants.
Any alliance between Ansar and the militants near the Libyan border could pose big problems for Egypt, which is aching for stability after three years of unrest triggered by the Arab Spring uprising.
A member of Ansar said leaders of the group had established ties with senior militants along the Libyan border. While no joint operations had been carried out in Egypt, militant leaders from Libya had travelled to the Sinai at the end of April and offered support, weapons, supplies and fighters, he said.
Egyptian security officials confirmed that links had been established between the two groups.
Islamists and the Egyptian state are old enemies. Islamist-leaning army officers assassinated President Anwar al-Sadat in 1981, mainly because of his peace treaty with Israel; and former President Hosni Mubarak fought insurgents for several years in the 1990s.
But the lightning seizure of large swathes of Iraq by the Islamic State has added to the sense of urgency in combating militants along Egypt's border with Libya.
Based on reports from informants, a security official who specialises in militant groups said: "The success of the insurgents in Iraq boosted the morale of the militants in Libya, and now they feel the time has come to show their power through action on Egyptian territory. They also hope that will get them more funds and weapons from al Qaeda."
Sisi, who has warned that Islamist militants ravaging the Middle East pose a threat to everyone, has said Egypt will not allow Libya's turmoil to threaten Egypt's national security.
Concerns deepened to such an extent that Egypt considered launching a cross-border offensive several months ago in a bid to crush the militants, according to two Egyptian national security officials.
"We were asked to investigate these groups and estimate their numbers so that action would be taken against them," said one of the officials.
An Egyptian military source said "of course the army studies these groups" but denied that there were plans for any cross-border offensive.
The camps in Libya consist of crude, one-storey cement huts in the desert, according to security officials. Militants there wear black headbands, carry al Qaeda flags and practise shooting on makeshift ranges.
It is not clear how many militants are in the camps. Some Egyptian security officials estimate between 2,000 and 4,000, and say they are mostly Egyptians.
Libyan officials said they know about security problems along the border and cooperate with Egyptian authorities. Libya's intelligence chief visited Egypt on Saturday to discuss border issues, security officials said.
But Libyan officials denied the existence of camps.
"We're doing regular patrols along the border between Libya and Egypt and have never noticed such a thing (camps). If the Egyptian troops notice any movements on Libyan soil they inform us like we inform them when we spot something on their soil," said Colonel Youssef Zakari, in charge of security patrols along the Egyptian-Libyan border.
A U.S. official said the Egyptian figures sounded too high. But Western diplomats acknowledge Sisi is deeply worried about the militants across the border and share his concerns because there are no signs that Libya will stabilise soon.
Egyptian security officials say some of the militants were pardoned by Muhammed Mursi, a Muslim Brotherhood leader who was elected Egypt's president in 2012 and then ousted by the army last summer. The militants fled to Libya after the army-backed government cracked down on Islamists, said security officials, and others fought in Syria against President Bashar al-Assad's forces.
Security officials say the militants' ranks include people such as Sarwat Shihata, an Egyptian sentenced to death in absentia for trying to kill Egypt's prime minister in the 1990s. After travelling to Afghanistan, Shihata returned home expecting life would be easier when Mursi was elected president, officials said.
When Mursi was ousted, Shihata travelled across the border, setting up contacts between the different militant groups in Libya, said a state security officer.
Police arrested Shihata three months ago in the Nile Delta province of Sharqiya, and he is currently being held in jail, security officials said.
"It was clear from our interrogation with Shihata that he was assigned by al Qaeda to be in charge of the funding and the training of those militant groups in Libya," said a state security officer who took part in Shihata's questioning.
"He had travelled to Libya several times after Mursi's ouster with a forged passport and met with militant elements there. Then he came to Egypt to meet with other militant elements in Sinai and other cities to coordinate between them."
Reuters could not independently confirm the details provided by Egyptian security officials about Shihata. Abdel Nabi Khalifa, a lawyer acting for Shihata, said Shihata did spend time in Libya and Afghanistan to evade death sentences, but that he was no longer a militant. He said Shihata had worked in the clothing industry in the period he returned to Egypt while Mursi was in power.
General Anani Hamouda, a senior regional security official, said he talks almost daily to the armed forces about the task of securing the border. The military has recently used aircraft to keep a closer eye on the region and monitor the Libyan side of the border, security officials said.
Last month, authorities uncovered a cross-border shipment containing more than 1,000 weapons, including machineguns and a few rocket-propelled grenades, said Hamouda.
Yet evading security checks and getting material across the border is easy if you can pay, locals said. Tribal smugglers told Reuters they charge up to 1 million Egyptian pounds ($140,000) to move weapons in four-by-four vehicles along desert routes the army is not aware of or finds too risky to patrol.
"The most dangerous is the region known as The Green Mountain, which is difficult for the army to travel to and secure," said tribal leader Omran Ambuu, who is familiar with the smuggling business. "It is all surrounded by quicksand."
Once arms are on Egyptian soil, they are sometimes hidden in huts under watermelons and pineapples with straw placed on top, security officials say.
"The danger of those militant groups is the amount and quality of the weapons they manage to get from Libya after the killing of Gaddafi and sneak into Egypt," said Eed al-Sarhani, a tribal leader wearing a traditional Bedouin white robe in a tent near the border.
The difficulties were evident in the town of Negila not far from the border. At a checkpoint in the town in late June, an army brigadier supervised seven soldiers who inspected vehicles crossing from Libya into Egypt. Yet a local supermarket owner, Ahmed Muftah, said trucks filled with militants in black uniforms with weapons slung over their shoulders come to him from time to time for supplies.
The militants travel 15 km into Egypt to buy tea, sugar, rice, fava beans and other goods before returning to Libya.
Muftah had wondered who these men were. When he mustered the courage to ask one of them, he was told: "One day you will know who we are." (Additional reporting by Yasmine Saleh and Michael Georgy in Cairo, and Ulf Laessing and Feras Bosalum in Tripoli. Writing by Michael Georgy; Editing By Richard Woods, Simon Robinson and Will Waterman)
Our Standards: The Thomson Reuters Trust Principles.