A Navy chaplain accused of failing to show “tolerance and respect” toward gay sailors has been cleared of all wrongdoing and will not be removed from the military.

“I am relieved the Navy sided with me,” Lt. Cmdr. Wes Modder told me.

Join Todd’s American Dispatch - a Must-Read for Conservatives

Modder, a highly decorated veteran who once ministered to an elite Navy SEAL unit, had been given a “detachment for cause” letter in February.

He was removed from his job after his commander accused him of being intolerant and unable to “function in the diverse and pluralistic environment” of the Naval Nuclear Power Training Command in Goose Creek, S.C.

“On multiple occasions he discriminated against students who were of different faiths and backgrounds,” wrote Capt. Jon R. Fahs, the chaplain’s commanding officer, in a memorandum obtained by Fox News.

Navy Personnel Command rejected the commander’s recommendation to fire Modder, Military Times reported.

“There is no documentation of poor performance in his personnel record,” one unnamed officer told the newspaper.

Instead, the chaplain, who is endorsed by the Assemblies of God, was cleared of all wrongdoing and will be allowed to retire — marking the end of nearly 20 years of military service.

“This is not only a great day for Chaplain Modder, but for every American who supports religious freedom in our military,” said Michael Berry, the chaplain’s attorney.

Berry is an attorney with Liberty Institute, one of the nation’s largest law firms specializing in religious liberty cases. They partnered with the law firm of WilmerHale to defend Modder.

“Although Captain Fahs’ actions against Chaplain Modder violated the Constitution, federal law and military regulations, we are grateful that Navy officials categorically rejected those actions,” Berry said.

“We believed this would be the outcome from day one.”Berry said the popular Navy chaplain was the victim of a setup.

Earlier this year, a gay married officer was assigned to be Modder’s assistant. The assistant initiated the complaint against the chaplain because of his views on homosexuality and same-sex relationships.

“I believe some of what the lieutenant has alleged could constitute a military crime - false statements, taking what the chaplain said and twisting or misconstruing it in an attempt to get the chaplain punished,” Berry told me.

Modder had also been accused of telling a woman that she was “shaming herself in the eyes of God” for having premarital sex and for berating an unmarried student for becoming pregnant.

Liberty Institute President Kelly Shackelford commended the Navy for exonerating their client and called it a victory for religious liberty.

“We always knew that when the facts came to light, the Navy would exonerate Chaplain Modder,” Shackelford said. “Religious liberty is our first freedom and essential for our men and women in uniform.

”It’s unfortunate that a good man like Chaplain Wes Modder has been subjected to public scorn and ridicule because of a young officer’s witch hunt. However, truth won the day and Chaplain Modder should be commended for his courage under fire and his long years of service to the United States Armed Forces."

And let this be a warning to those officers who might try to target other military chaplains. Your misdeeds will be exposed.

“We hope this sends a strong signal to military commanders — violating religious liberty will not be tolerated,” Shackelford told me.  

Todd Starnes is host of Fox News & Commentary, heard on hundreds of radio stations. His latest book is "God Less America: Real Stories From the Front Lines of the Attack on Traditional Values." Follow Todd on Twitter@ToddStarnes and find him on Facebook.