Ransom increasingly fills the coffers of Islamic extremist groups in the Middle East and North Africa, U.S. and other Western officials said, with the payments often coming from a Persian Gulf or Western European government.

Only U.S.-designated state sponsors of terror now provide more money to violent extremist groups than ransoms do, said David S. Cohen, U.S. Treasury undersecretary for terrorism. Ransoms have become the main source of funding for al Qaeda-related groups in Yemen and North Africa and an important source for such groups in Syria and Iraq, Mr. Cohen said in an interview.

He estimated that $120 million in ransom flowed to such groups from 2004 to 2012 and that since then, Yemen's al Qaeda branch alone has collected at least $20 million.

"Absolutely, Western states were paying direct" in Yemen, said Alistair Burt, Britain's state minister for the Middle East until October, speaking of his time overseeing the region. "Western states that frankly ought to have known better were covertly paying ransoms."

Several current European, Arab and other diplomats privately made the same assertion in interviews this spring. Asked for evidence of arrangements that are by nature secretive, they cited information gathered by their national intelligence agencies, by their own involvement in efforts to free Western hostages and from others involved in such efforts.

While businesses and other organizations also sometimes pay to free captives, the diplomats and officials said, government-paid ransoms have been game-changers. The Treasury has estimated that by 2011, ransoms were averaging more than $5 million a hostage in North Africa.

Efforts are being made to fight the practice. The U.S. and Britain won a pledge by the Group of Eight a year ago not to pay ransom to terror groups. In January, a United Nations Security Council resolution appealed to governments to resist paying to armed extremist groups.

"We regularly raise [the issue] with our counterparts in Europe and elsewhere," said the Treasury's Mr. Cohen. "The more these organizations believe they can benefit from taking hostages in, and getting paid off, the worse it is over the long run for everybody."

Among Islamic militant groups, those in North Africa were pioneers in relying on kidnapping as a funding source, said Vicki Huddleston, a onetime U.S. ambassador to Mali and former deputy assistant secretary of defense for African affairs. In 2010, she alleged that France paid $17 million to free four French hostages The French government called that a "rumor."

The think tank Rand Corp. said in a report this year that al Qaeda's North African branch was paid nearly $30 million in October for releasing four French hostages. The report didn't say who paid. As its source, it cited conversations with European diplomats in Brussels.

Asked to comment on the issue of payment to free hostages, a French foreign ministry spokesman said simply: "France doesn't pay ransoms." President François Hollande voiced the same policy in a television interview last year.

Many diplomats spoke of a role by Qatar in securing hostage releases. The small Gulf emirate has long used gifts from its oil wealth as an instrument of foreign policy and to help in mediating regional problems. It also proudly highlights its mediation role in winning freedom for kidnapped Westerners and Arabs. Qatari diplomats often publicly receive freed hostages, while European and Arab officials appear on TV thanking the emirate.

Besides its public role, Qatar sometimes plays a more private one, according to Britain's Mr. Burt and to several Western, Arab and other diplomats and officials involved in hostage releases.

In March, when Syria's radical Islamist al-Nusra Front freed 13 nuns and three other captive women in a deal brokered by Qatar and Lebanon, Qatar paid a $16 million ransom, according to a Lebanese official.

Britain's Mr. Burt said that while he believes Qatar has paid ransoms in some cases, Western governments sometimes have, too. "I don't believe the Qataris were responsible for paying all the ransoms. Some Western states were paying" as well, Mr. Burt said.

Calls to Qatar's government offices and foreign ministry in May, June and July went unanswered or were answered by someone who said nobody was available to comment. The emirate's foreign ministry made, but didn't keep, a June appointment to discuss the matter by phone.

Nusra said when it freed the women that it had merely held them for their protection and didn't collect a ransom.

Governments facing hostage situations have at times sought Qatar's help.

Silvia Eberhardt, a Swiss woman teaching English in a Yemeni town, vanished in March 2012 after leaving her private school. Soon, a hostage video appeared. "I'm in the hands of al Qaeda now," she said on it, wearing a head scarf. "I ask the Swiss embassy and the Swiss government to do what is necessary…to get me free."

On Feb. 27, 2013, Qatari diplomats flew to Yemen in a private jet to retrieve Ms. Eberhardt. A senior Yemeni official and an airport security official said they watched as five Qatari officials stepped out of the plane carrying bags that the Yemenis believed were filled with cash. The jet soon flew Ms. Eberhardt to Qatar, where the Swiss ambassador welcomed her.

A spokesman for Switzerland's Department of Foreign Affairs said that it "was in contact with the Qatari authorities, which enabled the negotiations for the release of the Swiss woman. After her release, the Swiss government has expressed its great gratitude to the state of Qatar, which carried out the negotiations so effectively."

The spokesman said, "Switzerland doesn't pay ransoms and didn't in this case," declining to discuss the matter further.

A woman in Switzerland believed to be Ms. Eberhardt confirmed her name when reached by telephone. Asked to discuss the kidnapping, she declined.

At the time of the hostage release, Yemen's foreign minister, Abu Bakr al Qirbi, made a blunt public complaint. "These arrangements made by Qatar...may have led to a disaster," he told Saudi Arabia's Asharq al Aswat newspaper. "Yemen constantly rejects the handling of the release of kidnapped hostages through the payment of ransoms."

"Don't blame us, blame the EU [countries]," Qatari diplomats said when confronted, according to a Yemeni official. The EU itself takes a firm position against payment of ransom, as do most European governments.

Yemeni officials blame ransom payments for helping revive the group called al Qaeda in the Arabian Peninsula. Its militants were "having crazy money problems before the kidnap ransoms. They were having to sell their guns," said Yasser Al Awadhi, deputy head of parliament for Yemen's former ruling party. Yemen appealed to governments to stop paying.

In the Yemeni capital of San'a, gunmen who essentially work on commission for al Qaeda roam the streets seeking foreigners to abduct, said diplomats and officials there.

Ali al Muteri, a guard at a San'a video shop, said he watched from his door as gunmen opened fire on an Italian U.N. worker, who crouched and scrambled, then surrendered to his kidnappers. Not just foreigners but Yemenis, too, are afraid, Mr. al Muteri said.

A Western diplomat in San'a said it is very hard to watch a video of a hostage from one's country pleading for rescue and do nothing. For officials to withstand the anger at home if a countryman, or especially a countrywoman, is slain by kidnappers, "politically, you have to be strong," the diplomat said slowly.

"And most of the time," the diplomat added, "the governments are weak. They are not ready to run the risk of someone being killed."