“It would have been a suicidal act.”

Michael Scott Moore was long into his 977 days held captive by Somalia pirates when a guard's carelessly laid gun offered him a way out.

Snatching one of the AK-47 assault rifles strewn on the floor of his prison compound would have been one way to end to the beatings, hunger, isolation and terror he endured.

Moore, author of The Desert and the Sea: 977 Days Captive on the Somali Pirate Coast, told nine.com.au how he weighed up ending his life in a blaze of gunfire.

"I was at a low point then. It would have been easy to grab one of the Somali's AK-47s and then start shooting some of them.

"But it would have been a suicidal act because the pirates outnumbered me."

Berlin-based American journalist Moore was snatched in Somalia in January 2012, shortly after he arrived there to research a book about Somalian pirates.

His kidnappers demanded a USD $20m ($28m) ransom which triggered long and painful negotiations between the pirates and Moore’s family to gain his release.

In those early months of captivity, he had to deal with false expectation time and time again.

“They [the pirate guards] would say, ‘Michael, don't worry, you're going to be out in two weeks, or a month’ or something - and it came to nothing. It was devastating.”

As a result, Moore realised the key to survival was to discard any expectation he would be free soon.

“Hope becomes a dangerous cycle. I learned I had to detach myself from it.”

But while he accepted his desperate situation, the desire for freedom burned deep within Moore, in acts of defiance, big and small.

When he was held on a drifting fishing vessel, he attempted to escape by jumping six metres over its side during the night.

"The engine wasn't in terrific shape, so I didn't think there was a way to turn around the ship,"

But the ship's captain cut the power and let the vessel drift towards him.

He made a split-second decision to take a lifejacket thrown to him by the pirate crew and was hauled back on board.

Moore, largely confined indoors during his captivity, never missed a chance to alert Western nations who he knew monitored Somalia.

He wore a bright red Manchester United football club shirt in the belief he would be spotted by drones or spy satellites.

"I also had a bright green pair of shorts. I'd wear them with the football jersey and wash them regularly. I figured if they were hung on a clothes line, they would draw attention to where I was being held."

On other occasions, when talking with his family by phone, German-speaker Moore passed on details of his captivity in that language, which his captors were unable to understand.

Moore was eventually released in 2014 after negotiations whittled down his ransom to $US1.6m ($2.1m).

After payment of the ransom, the freed journalist was flown out of Somalia by a pilot who had served in Britain’s Special Air Service.

Writing in The Globe and Mail, Moore recounted after their flight the former elite soldier said he made the right decision not to pick up a pirate gun.

He told the freed hostage: “The temptation would have been strong for someone like me. We’re wired to pick up the gun. But so many things can go wrong.”