Bill Larkin, who spent four decades in the New York state legislature following a distinguished military career that brought him to the battlefields of World War II and the Korea War, has died, his family announced Sunday. He was 91.

“America and the State of New York have lost a dedicated public servant, soldier and statesman,” the family said in a statement. “Our family lost a husband, father grandfather, great-grandfather and so much more.”

The Albany legend and legislative war horse died Saturday night, his spokesman Brian Maher said.

Gov. Andrew Cuomo lauded Larkin as “a constant force for good” in a statement Sunday.

“Senator Larkin led by example every day of his life and was an inspiration to me and countless others who wanted nothing more than to serve the people of this great state and nation,” Cuomo said.

“We owe him and his family the greatest debt of gratitude for his heroism and tireless devotion to our country. “

Born in Troy, NY in 1923, Larkin enlisted in the US Army at age 16 and spent more than 23 years serving his country before embarking on his political career.

In 1963, he served as Army Project Officer for President John F. Kennedy’s visit to Germany.

He was also one of the 2,000 US Army soldiers to guard Rev. Martin Luther King, Jr. during the historic 1965 march from Selma, Alabama to Montgomery.

“I looked directly at [King], he looked directly at me,” Larkin recalled to the Times-Herald Record in 2010. “He shook my hand and said, ‘God bless you. We’re praying we have a successful march.’”

But Larkin was humble about his role, saying he was “just a young Army officer with a mission.”

After retiring from the army as a Lt. Colonel in 1967, Larkin served a term as New Windsor town supervisor before joining the assembly from 1979 to 1990.

He began to serve in the state senate in 1991 and would go on to win 13 more terms representing the Hudson Valley’s 39th District.

The GOP senator was remembered as a noble and dedicated public servant, widely respected on both sides of the aisle.

“You could work with Bill Larkin across party lines. You trusted what he told you,” Former Westchester Democratic Assemblyman Richard Brodsky told The Post.

Calling Larkin a “legend,” State Sen. Diane Savino (D-SI) said her former colleague was instrumental in legalizing medical marijuana in 2014.

James Skoufis, who holds Larkin’s former seat, said his predecessor’s “lifetime of service and unwavering dedication to our country will live on as an inspiration.”

“He cherished his family above all else and would occasionally remind me, ‘happy wife, happy life,’” Skoufis tweeted.

In the year since his retirement, Larkin continued to be highly active in his community, promoting the Newburgh Armory community center and the national purple heart honor hall of honor, his spokesman said.

“He was continuing to help people and people were his passion and it was the honor of my life to be a part of that,” Maher said.

Larkin leaves behind his wife, Patricia, eight children 17 grandchildren and two great grandchildren.

Services will be held later this week.