(Adds Sunni tribes take border crossing with Jordan, Kerry meets Maliki)
* Visit comes after militant gains on the border
* Iran say U.S. trying to regain control of Iraq
* Kerry wants to forge an inclusive government
By Lesley Wroughton and Ahmed Rasheed
BAGHDAD, June 23 (Reuters) - U.S. Secretary of State John Kerry met Iraq's prime minister in Baghdad on Monday to push for a more inclusive government, even as Baghdad's forces abandoned the border with Jordan, leaving the entire Western frontier outside government control.
Sunni tribes took the Turaibil border crossing, the only legal crossing point between Iraq and Jordan, after Iraqi security forces fled, Iraqi and Jordanian security sources said.
The tribes were negotiating handing the post over to insurgents from the Islamic State in Iraq and the Levant who took control of two main crossings with Syria over the weekend. Kurdish forces control a third border post with Syria in the north.
Jordanian army sources said Jordan's troops had been put in a state of alert in recent days along the 181-km (112-mile) border with Iraq, redeploying in some areas as part of steps to ward off "any potential or perceived security threats".
Washington, which withdrew its troops from Iraq in 2011 after an occupation that followed the 2003 invasion that toppled dictator Saddam Hussein, has been struggling to help Iraq contain a Sunni insurgency led by ISIL, an al Qaeda offshoot which seized northern towns this month.
U.S. President Barack Obama agreed last week to send up to 300 special forces troops as advisers, but has held off from providing air strikes and ruled out redeploying ground troops.
Washington is worried that Prime Minister Nuri al-Maliki's Shi'ite-led government has worsened the insurgency by alienating moderate Sunnis who once fought al Qaeda but have now joined the ISIL revolt. While Washington has been careful not to say publicly it wants Maliki to relinquish power, Iraqi officials say such a message has been delivered behind the scenes.
There was little small talk when Kerry met Maliki, the two men seated in chairs in a room with other officials. At one point Kerry looked at an Iraqi official and said, "How are you?"
Iran's Supreme Leader Ayatollah Ali Khamenei on Sunday accused Washington of trying to regain control of the country it once occupied - a charge Kerry denied.
Iraqis are due to form a new government after an election in April. Maliki's list won the most seats in parliament but would still require allies to win a majority.
Kerry said on Sunday the United States would not choose who rules in Baghdad, but added that Washington had noted the dissatisfaction among Kurds, Sunnis and some Shi'ites with Maliki's leadership. He emphasised that the United States wanted Iraqis to "find a leadership that was prepared to be inclusive and share power".
Senior Iraqi politicians, including at least one member of Maliki's own ruling list, have told Reuters that the message that Washington would be open to Maliki leaving power has been delivered in diplomatic language to Iraqi leaders.
Recent meetings between Maliki and American officials have been described as tense. According to a Western diplomat briefed on the conversations by someone attending the meetings, U.S. diplomats have informed Maliki he should accept leaving if he cannot gather a majority in parliament for a third term. U.S. officials have contested that such a message was delivered.
A close ally of Maliki has described him as having grown bitter toward the Americans in recent days over their failure to provide strong military support.
The militants' control of the Western frontier extends two weeks of swift territorial gains and boosts ISIL's goal of a caliphate straddling Syria and Iraq.
The Jordan border was in the hands of Sunni tribesmen. An Iraqi tribal figure said there was a chance it would soon be passed to control of the militants, who seized the nearby crossing to Syria on the Damascus-Baghdad highway on Sunday.
He said he was mediating with ISIL in a "bid to spare blood and make things safer for the employees of the crossing. We are receiving positive messages from the militants."
The need to battle the Sunni insurgency has put the United States on the same side as its enemy of 35 years, Iran, which has close ties to the Shi'ite parties that came to power in Baghdad after U.S. forces toppled Saddam.
However, Iran's Supreme Leader Khamenei made clear on Sunday that a rapprochement would not be easy.
"We are strongly opposed to U.S. and other intervention in Iraq," IRNA news agency quoted Khamenei as saying. "We don't approve of it as we believe the Iraqi government, nation and religious authorities are capable of ending the sedition."
Some Iraqi observers in Baghdad interpreted Khamenei's comments as a warning to the United States to stay out of the process of selecting any successor to Maliki.
Baghdad is Kerry's third stop in a tour of Middle East capitals to emphasise the threat the insurgency poses to the region and call on Iraq's allies to use their influence to press Baghdad to govern more inclusively. He has also been warning Iraq's neighbours they need to step up efforts to cut off cross-border funding to the militants.
(Additional by Suleiman al-Khalidi in Amman; Writing by Oliver Holmes; Editing by Peter Graff)