In some faraway place, militants kidnap some of your compatriots, then demand money or the release of prisoners.

What's a government to do? It's a question that has been posed countless times.

Last year it got to the point where the G8 group of countries issued a communiqué stating, "We unequivocally reject the payment of ransoms to terrorists."

The United Nations Security Council had passed a resolution four years before that calls on countries to prevent the payment of ransom to groups and individuals associated with al-Qaeda. In the intervening three years, the G8 communiqué estimates, "al-Qaeda-affiliated and other Islamist extremist groups worldwide have collected tens of millions of dollars in ransoms."

The problem, the G8 stated, is that "payments to terrorists from Sahel to the Horn of Africa helped fuel instability in the region, and contributed to large scale attacks like In Amenas."

In Amenas was the mass hostage-taking at a natural gas plant in Algeria in January 2013. Abdel Rahman al-Nigiri, the head of the kidnappers, told Algerian security forces their demands were "so easy, if you want to negotiate with us."

Their demand was the release of 100 of their imprisoned comrades. Algeria responded with force, killing 29 of the hostage-takers, including at least two Canadians, and capturing three.

Those freed included 107 foreigners and 685 Algerian workers. At least 39 foreign hostages were killed during the four days of the crisis at In Amenas.

Last year, the U.K. Office of Security and Counter-Terrorism estimated that over 150 foreign nationals had been abducted by Islamist militant groups since 2008.

This weekend the world learned about the conclusion of two cases, involving three G8 states, one with the release of a U.S. soldier who was kidnapped in Afghanistan, and another in which a Canadian nun and two Italian priests were released.

When ransoms are paid or prisoners released after negotiations, governments rarely confirm that's what happened.

In what may be the most famous case, the 1980s Iran-Contra Affair, Ronald Reagan, then the U.S. president,  first claimed, "We were not trading arms for hostages, nor were we negotiating with terrorists," then admitted in 1987 that's what had taken place.

Here's a list of six recent, better known cases from what could be a long list:

1. Bowe Bergdahl

Afghanistan Taliban Talks

U.S. Sgt. Bowe Bergdahl, released on Saturday, is seen in a frame grab from a video released by the Taliban in 2010. (IntelCenter/The Associated Press, file)

U.S. army Sgt. Bowe Bergdahl was abducted in eastern Afghanistan on June 30, 2009. His captors, the pro-Taliban Haqqani network, released him on Saturday in exchange for five high-ranking Taliban militants who were flown from the U.S. prison at Guantanamo Bay, Cuba, to Qatar the next day.

The five had been held at Guantanamo since it opened in 2002.

The release comes as U.S. President Barack Obama proceeds to withdraw U.S. troops from Afghanistan in 2016. Obama's critics called it negotiating with terrorists and the Afghanistan government said the deal violates international law.

2. Gilberte Bussière, Giampaolo Marta and Gianantonio Allegri

Gilberte Bussières

Sister Gilberte Bussière and two Italian priests working as missionaries in northern Cameroon were abducted in April from their residences by two armed groups in the western African country. (Radio-Canada)

Gilberte Bussière, a 74-year-old Canadian nun, was abducted April 5 in Cameroon, along with two Italian priests, Giampaolo Marta and Gianantonio Allegri.

Bussière first went to Cameroon in 1979 and was involved in education, especially for girls.

Boko Haram, the group that kidnapped hundreds of Nigerian school girls, is believed to be responsible for abducting her.

The three were released last weekend.

Agence France-Presse, the French news service, cites an anonymous military source saying the three hostages were released after a fee was paid.

3. Thierry Dol, Daniel Larribe, Pierre Legrand and Marc Feret

France Hostages

French President François Hollande, 2nd left, walks on the tarmac with released French hostages Daniel Larribe, right, Pierre Legrand, 2nd right, Thierry Dol and Marc Feret, left, at Villacoublay military air base, outside Paris, last October. The four Frenchmen were held hostage by al-Qaeda militants after three years in captivity in the African Sahel. (Michel EulerAssociated Press)

On Sept. 16, 2010, al-Qaeda in the Islamic Maghreb kidnapped French nationals employed at a uranium mine near Arlit, Niger. The mine is run by France's state-owned nuclear company, Areva.

The last of the hostages, Thierry Dol, Daniel Larribe, Pierre Legrand and Marc Feret, were released in Mali last October.

The French government denied paying a ransom but there are rumours that a ransom worth $37 million was paid to win the release of those four hostages, and $19 million for the hostages released earlier.

4. Robert Fowler and Louis Guay


Louis Guay, left, and Robert Fowler, second from left, meet with Malian President Amadou Toumani Touré, right, in Bamako, Mali, following their release. ((Harouna Traore/Associated Press))

Canadian diplomats Robert Fowler, then the UN special envoy to Niger, and Louis Guay were abducted in Niger in December 2008 by al-Qaeda in the Islamic Maghreb.

The British government estimates that the militant group received $70 million in ransom payments from 2005 to 2011.

Fowler and Guay, along with two European tourists, were released April 21, 2009.

Prime Minister Stephen Harper denies paying any ransom but an al-Qaeda letter obtained by The Associated Press a year ago indicates the militants were paid $1.1 million to release the Canadian diplomats.

In 2012, one of the kidnappers, Oumar Ould Hamaa, told the New York Times that ransom was how al-Qaeda in the Islamic Maghreb gets its funds. "Lots of Western countries are paying enormous sums to the jihadists,” he said.

Fowler wrote about the kidnapping in his book, A Season in Hell: My 130 Days in the Sahara with Al Qaeda.

5. Mellissa Fung

Afghan Cda Kidnap

While being held by kidnappers in 2008 in Afghanistan, CBC journalist Mellissa Fung told herself, 'Dying is not an option.' (The Canadian Press)

CBC correspondent Mellissa Fung was abducted in Kabul, Afghanistan, on Oct. 12, 2008, and held for 28 days.

Her kidnappers were from an Islamist group, according to the Taliban.

CBC reported no money was paid and Harper told the media after Fung was free, "There has been no release or exchange of political prisoners."

In an interview after returning to Canada, Fung gave her understanding of how events unfolded: "Afghan intelligence had sort of fingered the family of the ringleader of this gang and had arrested a whole bunch of them, and... they agreed to release the family if the group would release me, and that's what ended up happening."

Fung wrote about her ordeal in her book, Under an Afghan Sky: A Memoir of Captivity.

6. Amanda Lindhout and Nigel Brennan


Alberta journalist Amanda Lindhout was freed in 2009 after being kidnapped in Somalia. ((CBC))

Three days after arriving in Mogadishu, Somalia, Canadian freelance journalist Amanda Lindhout and Australian photojournalist Nigel Brennan were abducted by an Islamist group on Aug. 23, 2008, along with their translator and two drivers.

The Canadian government, as well as a negotiator hired by Lindhout's family, were involved in the release efforts.

Lindhout and Brennan were released 15 months later, following a ransom payment of about $1.2 million, apparently by their families. The other three had been released in January 2009.

Lindhout wrote about the kidnapping in her memoir, A House in the Sky, as did Brennan in The Price of Life.