John McLeod was a 21-year-old Marine from Maine when he became privy to one of the best-kept secrets of World War II.

It’s one he’ll never forget.

In the spring of 1945, McLeod was a private in the communications unit with the 7th Marine Regiment, 1st Division. He was stationed on the island of Okinawa during one of the bloodiest campaigns of the war, an 82-day battle in which more than 65,000 American troops were killed, wounded or missing in action, with the Japanese casualties even higher.

McLeod, who grew up in Portland and now lives in Westbrook, worked side by side with a soldier named Rex Kontz, a Navajo from Fort Defiance, Arizona.

“Rex and I worked out in the field,” said McLeod, 91. “But we had a canvas shelter to protect the radio and code machine.”

He remembers listening as Kontz talked on the radio to troops under artillery fire miles away, not understanding a word being said.

“It was gibberish to me,” McLeod said.

Gibberish that helped win the war.

Kontz was one of an estimated 400 Navajos who served in communications units during World War II, sending top-secret messages in a code they had developed.

The code talkers’ contribution to the war effort was officially recognized in 1982 when then-President Ronald Reagan declared Aug. 14 as National Navajo Code Talkers Day.

It’s a day that McLeod takes to heart. After all, it was his job to keep Kontz safe.

But not in the way Hollywood depicted.

“I wasn’t his bodyguard,” McLeod said. Neither was he – nor anyone else – ever ordered to shoot a code talker in danger of being captured by the enemy.

But keeping Rex Kontz safe was a priority.

“I had to watch out for him … protect him if I could,” McLeod said. “Everybody else who was with a Navajo had to do the same thing.”

The code talkers worked in tandems: One was on the front line and his counterpart was at headquarters.

In Okinawa, Kontz was at headquarters.

“He would get a message from another Navajo (code talker) that was important,” McLeod said, “and he would write it down in English and I would take it from him and give it to the commanding officer.”

Kontz was a quiet guy, completely focused on the job, McLeod said. The two didn’t spend much time chatting.

“He wore those earphones all the time,” McLeod said.

Kontz and 29 other Navajos, most of them teenagers, were recruited by the Marines in 1942 as part of a plan concocted by Philip Johnston.

Johnston, whose parents were missionaries, grew up on the Navajo reservation in Arizona. He approached the military with the idea of using Navajo speakers to develop and send code, as other Native Americans had done on a smaller scale during World War I.

The Navajo language is unwritten. When spoken, the pitch and tone of voice can completely change the meaning of a word. That gave the Navajo recruits the ingredients for an indecipherable code.

Now they needed a foolproof recipe.

The 30 men – one eventually dropped out – worked at what became known as the Navajo Code School at Camp Pendleton in California and came up with a code that would confound the enemy.

First, they designated specific words in Navajo to represent English words frequently used by the military.

“In the Navajo language,” said R.O. Hawthorne, 88, a former code talker and now vice president and chief operating officer of the Navajo Code Talkers Association, “we never had a word for ‘machine gun,’ ‘fighter plane,’ ‘battleship,’ all those things.” So a fighter plane, Hawthorne said, was called a hummingbird: in Navajo, the sound is di-he-tih-hi. The code word for battleship was “whale,” and for armored vehicle, “turtle.”

Each letter of the alphabet also was represented by a Navajo word.

The code consisted of about 400 terms that each code talker committed to memory. Most of the information they were asked to transmit concerned critical combat intelligence, like troop movements and fire support.

“It was somewhat difficult,” Hawthorne said, “’cause we weren’t allowed to keep our notes. … At night, when it was time to sleep, we would choose somebody as a partner and rehearse the code.”

The original group of 29 code talkers then began training other Navajo recruits. Code talkers were used in every major battle in the Pacific Theater from 1942 to 1945.

Because their code was so secure, they could use radios and field telephones to transmit messages, a much more rapid and efficient means than sending them by machine.

Their speed and accuracy were astounding. According to several accounts, code talkers at the battle of Iwo Jima delivered more than 800 encrypted messages over a two-day period without a mistake.

It was a code within a code, said Charles Melson, the U.S. Marine Corps’ chief historian.

“Apparently, the Japanese intercepted and recorded their voice conversations,” Melson said. “They knew it was Navajo. But because Navajo is a tonal language, they couldn’t transcribe it, couldn’t make a hard copy for anyone to decipher.”

The code was never broken.

“I like to say that the Navajo code talkers sunk the Rising Sun,” Hawthorne said.

After the war, Kontz went back to Arizona and worked for the Bureau of Indian Affairs and in tribal government. He rarely talked about his military service.

“They were told to keep quiet about it,” said his son, Richard Kontz, who lives in Gallup, New Mexico. “So he would never talk about it. He said, ‘We’re not supposed to.’ ”

Kontz died in 1980. The last of the original 29 code talkers, a man named Chester Nez, died in June.

McLeod left the military in 1946 and spent most of his career working in machine shops, but he will never forget those days on Okinawa.

In the torrential rain and mud, in the heat and horror that was Okinawa in the spring of 1945, a bond formed between McLeod and Kontz.

One based on deep respect.

“I was honored to serve with him,” McLeod said.