WASHINGTON — Joint Chiefs Chairman Gen. Joseph Dunford said he advised administration officials to let all qualified individuals serve in the military, a view that was ignored when the White House announced its ban on transgender troops this summer.

“I believe that any individual who meets the physical and mental standards … should be afforded the opportunity to continue to serve,” Dunford told members of the Senate Armed Services Committee during his reappointment hearing on Tuesday.

He added that he had previously given that advice to administration officials in private in the past, and told senators he would continue to give that advice if lawmakers allow him to continue in his leadership post for two more years.

In July, President Donald Trump announced via Twitter that he would not allow new transgender recruits to join the military and would review whether currently-serving transgender troops would be booted from the service.

At the time, Trump said he made the decision “after consultation with my generals and military experts.”

But that apparently did not include Dunford, who has been the top military officer for the entirety of Trump’s presidency. He told lawmakers he believes that transgender troops have served honorably since last year, when Defense Department officials announced new rules changes that allowed them to serve openly.

He said he had not yet met with any transgender troops in recent months to discuss challenges facing them, but said he would be open to the idea.

In August, Trump issued a presidential memo formally maintaining a ban on any new transgender recruits, halting the use of military funds for sex reassignment surgery, and ordering Defense Secretary Jim Mattis to determine whether transgender personnel currently in uniform should be allowed to stay.

Mattis has said he expects that review to be finished early in 2018.

Several members of the Senate Armed Services Committee have offered legislation to speed up that study but bar the military from dismissing any troops on the basis of gender identification. One of those sponsors, New York Democrat Kirsten Gillibrand, told Dunford on Tuesday she was “deeply disturbed” by Trump’s sudden actions on the issue.

The RAND Corporation has previously estimated the cost of health care services for transgender troops at close to $8 million a year.

Outside rights groups have estimated that up to 15,000 transgender individuals are already serving in the ranks, while Defense Department estimates have put the figure at around half that total. But only a few hundred have contacted military officials with requests for medical treatments since last fall, when military officials announced they would allow transgender individuals to serve openly.