* Fight against Islamist militancy also on Kerry agenda
* Tunisian uprising in 2011 inspired wave across Arab world
* Tunisia's advances contrast with setbacks in Egypt, Libya (Adds details)
By Arshad Mohammed and Patrick Markey
TUNIS, Feb 18 (Reuters) - U.S. Secretary of State John Kerry made an unannounced visit to Tunisia on Tuesday to praise democratic progress in the country where the "Arab Spring" began and discuss the threat of Islamist militants there.
After a crisis last year brought on by the killing of two opposition leaders, Tunisia's transition got back on track when it adopted a new constitution and the ruling Islamists stepped aside for a caretaker administration to govern until elections.
Kerry's visit was to highlight progress made since the 2011 uprising that brought down autocrat Zine el-Abidine Ben Ali as well as the compromises new Tunisian leaders, unlike Egyptian and Libyan counterparts, have made, U.S. officials said.
"We are very impressed by the steps that you have been taking, by the rational thoughtful approach to the transition," Kerry said, according to a pool report by a U.S. reporter, after meeting Tunisian President Moncef Marzouki.
The new constitution and steps to full democracy have been praised as a model in a region still widely unstable since popular revolts in 2011 that ousted long-standing rulers in Egypt, Yemen and Libya.
A senior U.S. official told reporters as Kerry flew to Tunis that Washington applauded Tunisia's "demonstrated willingness not to take power, and hold on to it, and see it as a zero sum game, but to find some degree of compromise."
Egypt's military last year ousted its democratically elected Islamist president after a spate of mass protests against his rule. Libya is floundering in disorder with its weak central government unable to impose its authority on rival political factions and brigades of former rebels.
MORE ON 2012 EMBASSY ATTACK
Kerry was also likely to address the many challenges still facing Tunisia, among them persistent violence by Islamist militants whose leader has pledged allegiance to al Qaeda's North African wing, officials said.
During meetings with the Tunisian president and prime minister on Tuesday, Kerry planned to urge the government to do more to arrest and prosecute those responsible for a 2012 attack on the U.S. embassy in Tunis.
Tunisian security forces have been battling militants from the banned Islamist movement Ansar al-Sharia, one of the radical groups to emerge after Ben Ali's fall.
Ansar al-Sharia was blamed for inciting the storming of the U.S. embassy in Tunis on Sept. 14, 2012 and has since been listed by Washington as a terrorist organisation, with ties to al Qaeda in the Islamic Maghreb.
Kerry's visit to Tunisia is the first by a U.S. secretary of state since that incident, which occurred three days after an attack on a U.S. diplomatic mission in Benghazi in Libya killed the U.S. ambassador and three other Americans.
While violence from Islamist militants is sporadic in Tunisia, which relies heavily on European tourism, militants have been using the chaos in neighbouring Libya to get access to arms and training across the porous border.
In the first such attack in a decade in Tunisia, a suicide bomber late last year tried to target a hotel in a popular tourist resort near Tunis, killing only himself in the attack.
Earlier this month, Tunisian police killed seven Islamist militants, including a commander wanted for the assassination of the two opposition leaders, after a clash outside Tunis where the armed group stashed arms and suicide bomb belts.
The small North African country has also appealed for help in building up its economy after its political crisis. International lenders are keen for Tunis to institute more reforms to curb public spending and cut its budget deficit. (Editing by Mark Heinrich)
Our Standards: The Thomson Reuters Trust Principles.