It is frequently voted one of the top TV moments of all time: Sir David Attenborough’s close encounter with a family of mountain gorillas in the Virunga mountains of Rwanda in 1978.

A new documentary has revealed that the footage that cemented the landmark status of the BBC’s Life on Earth natural history epic almost never made it out of Africa.

The sequence captures the moments in which Attenborough, then 51, lay on the floor close to a mother gorilla and her youngsters.

“There is more meaning and mutual understanding in exchanging a glance with a gorilla than any other animal I know,” Attenborough said at the time. “We see the world in the same way as they do.”

The production, first broadcast on the BBC in 1979 and watched by 500 million people worldwide, is recalled in Making Life on Earth: Attenborough’s Greatest Adventure to mark Attenborough’s 100th birthday on May 8.

Attenborough reads aloud from his diaries in the hour-long special, which will air on BBC1 on Sunday. “After months of planning, we travelled to Rwanda for one of the last shoots of the series. We had no idea what we were about to witness or how close we would come to losing everything,” he said.

David Attenborough filming with mountain gorillas in Rwanda for the "Life on Earth" series, 1978.Soldiers accused Attenborough and his team of not having permits to film the gorillasJOHN SPARKS

“The first sign of trouble is a soldier who tries to flag us down. When the driver ignores him and drives past, he loads his rifle and shoots in the air. There was a sort of ‘waaang!’, like in some feature film, with bullets going by. I thought: ‘What’s happening?’ And we turned round the corner and there was an armed guard.”

The crew encountered the army roadblock as they returned from filming the gorillas, and the rare footage was recorded on cans of fragile film.

The production process had already been arduous, involving long-distance postal correspondence with the primatologist Dian Fossey, which took weeks at a time. Now, the challenge lay in getting it back to the BBC’s natural history headquarters in Bristol.

“A Land Rover drives towards us, blocks the middle of the road, so we must stop,” Attenborough said. “The driver is enraged that we have no right to be filming: ‘We have no permit. We didn’t check with the park office. We’ve been filming with dead gorillas.’ Road blocks by the commandos are ahead, so we can’t escape.”

Suspected of filming sensitive material, the crew was transported to a police headquarters and interrogated about their activities.

Martin Saunders, the cameraman, quickly realised the danger posed to the precious film and set about swapping the labels on the cans to make it appear as if those containing the gorilla footage were unused.

David Attenborough and Martin Saunders on location for Life on Earth, Comoros.Attenborough with Martin Saunders in the ComorosROGER LONG/BBC

The crew was held overnight under hotel arrest before Attenborough and the producer, John Sparks, were taken to an army compound in the middle of Kigali, where they were made to stand and wait in the hot sun, prompting Sparks to ask: “Are they going to put us up against the wall and shoot us?”

Eventually they were released, but the tension only eased when their plane was airborne.

It was not the first time that there was relief surrounding the footage. The moment was almost not captured at all due to the crew’s concern about the amount of film they had.

The scene had originally been envisaged as an opportunity for Attenborough to talk about the gorilla’s dexterity. After crawling back to the crew to confirm they had recorded his 15-minute close encounter, which Attenborough described as “one of the most privileged moments of my life”, he was surprised by the response.

“We got a bit,” Attenborough was told by Sparks, who added: “I was waiting for you. I didn’t want to run out of film while you were explaining about the thumb and the forefinger.” Attenborough explained: “It’s very difficult to talk about the importance of the opposition of the thumb and forefinger with a female gorilla with her finger in your mouth.”

The series helped to propel Attenborough to become the nation’s foremost TV natural history presenter after a successful career as a BBC executive, which resulted in bosses wanting him to become its director-general.

Attenborough said that he has not once regretted his career path since turning down the top job in the 1950s.

“I wouldn’t have been any good as the director-general,” he said. “The director-general is a hugely demanding job. The skills are not mine. I don’t have political skills. I don’t have political sensitivities. I may know about birds of paradise, but I certainly don’t know about prime ministers.”