When the International Criminal Court (ICC) was born 11 years ago, it may have seemed such an idealistic, noble idea that it could have leapt from the pages of a superhero comic book.

It would be a place where the world’s worst evildoers, no matter how powerful, would have nowhere to hide from justice.

In the real world, though, it was never going to be easy to prosecute powerful governing leaders. From the start, critics called the court, based in The Hague, a neocolonial tool of the West and accused it of anti-African bias. And now its job has been further complicated by a seemingly incidental event: the recent terrorist attack on a shopping mall in Nairobi, Kenya.

Last month, the ICC opened its first trial of a sitting government leader, Kenya’s deputy president, William Ruto, on charges of crimes against humanity. Kenyan President Uhuru Kenyatta will face similar charges in November.

Even before the shopping mall attack, the rights group Amnesty International was complaining that Kenya had pulled out all the stops to derail the trial and undermine the court’s credibility.

The attack on the Westgate shopping mall, which killed at least 67 people and riveted international attention, boosted Kenyatta’s domestic support and hardened Kenyan sentiment against the court, which requires Kenyatta and Ruto to appear in The Hague, Netherlands.

Kenyatta, who lost a nephew in the attack and was praised by some Kenyans for his government’s response to the crisis, may argue that as commander in chief, and with the country facing war in Somalia and the threat of further terrorist attacks, he can’t afford to be on trial overseas.

The ICC, established in 2002, has jurisdiction in 122 countries, including 34 in Africa. But the United States, China, Russia, Israel, Pakistan, India, North Korea and others refused to sign or to ratify the Rome Statute that set up the court.

Its Africa fixation - with all of its 18 cases involving the continent - has stirred the opposition of the African Union (AU), a body with a reputation for often behaving like a trade union for incumbent leaders.

The indictment of Sudanese President Omar Hassan Ahmed Bashir in 2009 severely strained the court’s relations with the African Union, which announced that it would not co-operate with the arrest warrant. The prosecution of Kenyatta and Ruto sent a deeper chill through the AU, which will debate a mass exit from the ICC in coming months, according to African officials.

Its latest charges,  announced this week, are against Charles Ble Goude of Ivory Coast, a close ally of the indicted former president, Laurent Gbagbo.

If Africa abandons the ICC, it will be a catastrophic setback, undermining the court’s credibility and its ability to investigate and prosecute war crimes, genocide and ethnic violence against Africans. Before the establishment of the ICC, such cases either were not prosecuted internationally or were handled by ad hoc tribunals, such as those involving Rwanda’s 1994 genocide and war crimes in the former Yugoslavia.

Kenya’s Parliament voted last month to quit the ICC, but the move doesn’t affect the current trial. Kenyatta and Ruto are accused of orchestrating ethnic violence after the disputed election in December 2007. More than 1,000 people died in attacks across Kenya.

But the Kenyan government has exploited African disillusionment with the court, portraying it as going after not just Kenyatta and Ruto, but also all Africans.

Uganda’s increasingly authoritative leader, Yoweri Museveni, once an ICC supporter, is now one of its ardent critics. After Kenyans voted Kenyatta and Ruto into power in March, Museveni used Kenyatta’s inauguration to attack the court and the West.

“The usual opinionated and arrogant actors using their careless analysis have distorted the purpose of that institution. They are now using it to install leaders of their choice in Africa and eliminate the ones they do not like,” Museveni said.

Ethiopian Prime Minister Hailemariam Desalegn said in May that ICC prosecutions “have degenerated into some kind of race hunt” against Africans.

A solution to African dismay over the ICC could be an African tribunal capable of dealing with crimes against humanity, but efforts to establish one have won little support from governments on the continent. A mass departure from the ICC would leave African victims of genocide and other crimes against humanity with nowhere to turn, Amnesty International said recently.

Human rights groups, the strongest advocates of international justice, are broadly supportive of the court but critical of its flaws, such as incomplete, unbalanced or slow investigations.

Human Rights Watch spokeswoman Elizabeth Evenson rejected claims that the court was anti-African but said, “One reason why this has so much traction is perceptions of double standards. People see that there are some countries still outside the ICC, like the US, Russia and China. Ultimately that’s not really the fault of the ICC itself.”

The court considers itself a lofty body above politics, but it’s often perceived in Africa as deeply political, called in by some leaders to sideline enemies in conflicts, according to analysts.

“There’s a sense from many local groups that the court is very inconsistent in terms of the suspects it pursues. We have seen the court cozy up to political leaders in cases like Uganda and (Democratic Republic of) Congo. The complaint we hear is that the court has been manipulated,” said analyst Phil Clark, an expert on international justice at the University of London.

He said the court’s investigations of highly complex situations in Africa had often been weak because of poor resources and lack of local expertise. Its protection of witnesses also was inadequate.

“I think the court’s had a problem with legitimacy right from the start of its work in Africa,” Clark said. “The ICC tends to overstate its importance in Africa and often overstates the impact it can have on conflicts in Africa.”

But Evenson said that although African leaders don’t like the court, “we see very strong support for the ICC, particularly from African civil society.”

In the Kenyan trials, many key prosecution witnesses have withdrawn under pressure from their communities and relatives,  who fear repercussions.

Frank Mwangi, a Kenyan lawyer for one witness who recently withdrew from the case, told Kenya’s Nation newspaper that his client had lost everything she had in the 2007 and 2008 violence, but that she withdrew because she couldn’t testify without knowing how she and her family would be protected.

“I feel my security and that of my family will be in jeopardy since no efforts have been made to provide them with adequate security. What assures me I will be protected after I have testified?” she said in an affidavit to the ICC, according to the report.

Witnesses’ fear was heightened after a newspaper, bloggers and others in Kenya published a photograph of a woman who they claimed was the first trial witness against Ruto, identified in court only as Witness 536. The court had tried to guarantee her anonymity.

Last week, the court unsealed a warrant for the arrest of a Kenyan journalist accused of trying to bribe witnesses in the cases against Ruto and Kenyatta.

Political analyst Ngunjiri Wambugu contends that the Westgate attack offers Kenyatta a “silver lining”, a chance to recast his presidency and perhaps avoid the ICC trial.

Writing in the Star newspaper recently, Wambugu argued that the cases against Kenyatta and Ruto should be reconsidered, and said of the president: “He now has an opportunity to remind Kenyans and the world that our country is at war, and point to Westgate as to why we cannot afford to have a president with divided attention.”

Although critical of the court’s focus on Africa, some analysts say the claims of bias don’t hold. Five of the 21 judges and its chief prosecutor are Africans, and most of the cases were referred to the court by African governments. Others were referred by the United Nations Security Council. Few were initiated by the court.

Despite the difficulties in the current trials, Clark, the University of London analyst, said the court has too much international support to be abandoned, even if the Kenya cases collapse, and even if it continues to blunder. Still, he was hardly blithe about its future.

“I think the likely scenario is it’s going to continue to limp along,” he said. “There seems to be a prosecutorial strategy of lurching from one country to another, making the same mistakes, using investigators who don’t understand the African continent.”