(CNN) Former Secretary of the Navy Ray Mabus decried President Donald Trump's efforts to prevent transgender individuals from serving in the military.

"This notion that all of this work's been done and these people felt safe as transgender, felt safe coming out, joining the military, and then suddenly the rug gets jerked out from under -- it's not the way to treat patriots, it's not the way to build a great military force either," Mabus said on "The Axe Files," a podcast from the University of Chicago Institute of Politics and CNN.

Mabus, who served as head of the Navy under President Barack Obama from 2009 to 2017, lamented that the Pentagon "didn't move fast enough" in instituting a policy to allow transgender individuals to openly serve in the military.

SAN FRANCISCO, CA - AUGUST 16: U.S. secretary of the Navy Ray Mabus speaks during a ship naming ceremony for the new USNS Harvey Milk on August 16, 2016 in San Francisco, California. U.S. Navy officials announced plans to name a new replenishment oiler ship after slain civil rights leader Harvey Milk. Six new ships in the class with be named after civil and human rights leaders. (Photo by Justin Sullivan/Getty Images)

"We could have solved that under President Obama but it wasn't done and it was left for the next administration," Mabus explained.

That policy was still under review in July 2017 when Trump announced in a series of tweets that he would reinstate the ban on transgender troops. Mabus suggested the move was done "out of prejudice and bias and to rile up (his) base."

Read More