(CNN) New Mexico Sen. John D. Pinto, a former World War II Navajo Code Talker, died Friday morning, according to a statement from his family.

Pinto was 94 and was the longest-serving senator in New Mexico, where he had been serving since 1977, according to New Mexico's Senate website

"He dedicated his life to public service. He worked tirelessly throughout his lifetime to serve the Diné people," the Pinto family's statement read. Diné is a Navajo term meaning people.

"The family would like to express their gratitude to his constituents and fellow legislators for allowing him to serve, it is what truly made him happy."

Pinto was a member of the Indian and Cultural Affairs Committee and the Senate Education Committee, according to the Senate's website. A look through the bills he sponsored shows Pinto sponsoring legislation to benefit the Navajo people. One of the bills he sponsored in both 2018 and 2019 looked at allocating $1 million to a Navajo Code Talkers Museum and Veterans Center.

Pinto served as a Navajo Code Talker in the US Marines before becoming a teacher, according to CNN affiliate KRQE-TV . Code Talkers were Marines who spoke Navajo, a native American language they used to create a spoken code that Japanese code breakers were never able to decipher. It was used to send information on tactics, troop movements and orders over the radio and telephone.

The code was a key factor in the American military victories at Iwo Jima, Saipan, and several other major battles in the Pacific theater.

More than 400 Navajo had learned the code by the end of the war. None of the original 29 code talkers who invented the language are still alive. Chester Nez, the last surviving member of the original 29, died in 2014

The program wasn't declassified by the military until 1968, and it would take several more decades before the story received wider recognition. In 2001, President George W. Bush presented the 29 original Navajo Code Talkers with the Congressional Gold Medal.

Navajo Nation and politicians react to Pinto's death

Navajo Nation President Jonathan Nez said "words cannot express the sadness we feel for the loss of a great Diné warrior."

"He dedicated his life to helping others and he changed the lives of so many people for the better," Nez said. "We will miss his smile, his humor, and his love and compassion for the Navajo people."

New Mexico Gov. Michelle Lujan Grisham ordered all state flags to fly at half-staff effective immediately, according to a joint news release from the senator's family, the governor's office and the Navajo Nation.

"John Pinto's towering legacy stretches far beyond the borders of New Mexico, and his loss will be felt across not only this nation but the world," Grisham said. "He was a New Mexico icon and an American hero."

Senator John Pinto was a New Mexico icon and an American hero. I will miss his good humor, as will everyone at the Capitol, and I offer my deepest condolences to his loved ones, his family and friends. pic.twitter.com/oAectRmWQi — Gov. Michelle Lujan Grisham (@GovMLG) May 24, 2019

Albuquerque Mayor Tim Keller said when he and Pinto served as senators together, Pinto was the oldest at 83 and he was the youngest at 29.

"Today our state lost a legend, & I lost an old friend. Senator John Pinto and I became very close during the time we served together in the Senate. At 29, I was the youngest senator, & at 83, he was the oldest. We often ate together and worked together over the next six years," Keller said on Twitter.

Today our state lost a legend, & I lost an old friend. Senator John Pinto and I became very close during the time we served together in the Senate. At 29, I was the youngest senator, & at 83, he was the oldest. We often ate together and worked together over the next six years. pic.twitter.com/rp40nJwrat — Mayor Tim Keller (@MayorKeller) May 24, 2019

Navajo Nation Council Speaker Seth Damon said Pinto's contributions to the Navajo people and New Mexico citizens are "too numerous to list."

"The impact he made in the soul of the Navajo People and New Mexico citizens as a leader will continue for generations," Damon said.