* Ansar al-Sharia man checkpoints, patrol hospital
* Witnesses saw members at U.S. attack - denies involvement
* Security situation complex on anniversary of uprising
By Hadeel Al Shalchi
BENGHAZI, Libya, Feb 17 (Reuters) - An Islamist militia linked to the attack on the U.S. consulate in Benghazi and kicked out of the city by locals is back openly manning checkpoints and building up support promising much-needed security.
Heavily bearded youths from Ansar al-Sharia control the western entrance into Libya's second biggest metropolis, patrol a hospital and check cars and trucks passing through another checkpoint in the south.
Witnesses say the group's members were at the scene of the Sept. 11 attack that killed the U.S. ambassador, Christopher Stevens, and three other Americans - though Ansar al-Sharia denied any involvement.
Days after the assault, outraged residents drove the group out of its bases in the city in a "Rescue Benghazi" protest.
The group's highly visible return, five months on, underlines the complex security situation on the ground two years after the start of the revolt that ousted Muammar Gaddafi.
Many in the West see Islamist militants as the biggest threat to the security of the oil-producing country and the region - and accuse them of carrying out a string of attacks on police and foreigners in the city in recent months.
Their fears echo international concerns about the rise of Islamism in other countries shaken by the Arab Spring uprisings, including Libya's neighbours Egypt and Tunisia.
But the groups are also held up as heroes of the Libyan uprising by some locals who say they are doing a better job of the protecting them than the government in distant Tripoli.
As celebrations began marking the revolt's anniversary, at least one person waved Ansar al-Sharia's white flag at a rally.
"These men are also people who fought on the front lines, care about their city and provide services. We can't shun them," said Benghazi University professor Iman Bugaighis. "We had to ask them to come back and protect our hospital and streets."
Libya's deputy prime minister, Awad Ibrahim, on Sunday acknowledged the security role played by militias, without specifically mentioning Ansar al-Sharia.
"These militias are part of our liberation. We cannot exclude them at least at this time until we build our army and police," he told Reuters in Benghazi, the cradle of the revolt.
The men at Benghazi's western checkpoint say they have been working there for about a month to maintain security in the run up to the anniversary celebrations.
They also patrol Benghazi's Galaa Hospital where officials said a patient was killed in a fight two weeks ago.
Benghazi council spokesman Osama al-Sharif said hospital staff and residents had had no choice but to ask locals - including Ansar al-Sharia members - to protect the facility.
"It's just the reality of the city. The police have complained of a lack of authority and resources and the interior ministry says it can't do it so we have to rely on these brigades," he said.
The militiamen say they are protecting what they fought for during the war and helping the city's residents.
"We have been seizing illegal medical supplies and contraband and handing it over to the government," said Faisal al-Jamie, in charge of one of the brigade's checkpoint shifts.
"The government told us to get out of the way and it wanted to take over security in the city so we removed ourselves. But then we saw the government wasn't doing anything and the city needed securing so we had to come back and protect our city."
Hundreds of cars pass the checkpoint every day where Ansar al-Sharia pick-up trucks mounted with anti-aircraft weapons acquired in the war are parked on either side of the dusty road.
One of the cars honks at the men in greeting and a passenger waves the black and white flag of al Qaeda.
After Ansar al-Sharia was kicked out of its bases in September, some of its members were absorbed into other armed brigades dotted around the country.
Others quietly returned, keeping a low profile, running a clinic and teaching the Koran. They removed their logo from their vehicles, but have gained enough confidence to acknowledge their allegiance publicly.
The group, whose leaders have turned down repeated interview requests from Reuters, is part of a wider Salafi Muslim movement that follows a puritanical form of Islam.
Many Islamist groups were persecuted under Gaddafi's rule, their leaders imprisoned and tortured in prison. Supporters have refused to join the country's new security forces, saying the police is still filled by Gaddafi's backers.
Far from everyone is happy with the group's rennewed influence.
"The government lost a very good opportunity after our 'Rescue Benghazi' event to control these militias, break them apart and absorb them into legitimate bodies," Younes Najim, an organiser of the campaign to push Ansar al-Sharia out.
"It will take time, but the longer the government takes to organise its security here, the stronger some groups will make themselves to become parallel forces to the government." (Additional reporting by Ghaith Shennib and Ahmed Al-Rubaie; Editing by Marie-Louise Gumuchian and Andrew Heavens)