The Massachusetts National Guard will continue to allow transgender people to serve, despite a federal ban put in place by President Donald J. Trump.

“The Massachusetts National Guard and the Baker-Polito Administration will continue to support transgender Soldiers and Airmen in serving our Commonwealth with dignity and respect,” Secretary of Public Safety and Security Thomas Turco wrote in a letter to legislators. “The Massachusetts National Guard serves the interests of the Commonwealth and the Nation best with a military force that recruits and retains the most qualified people without regard to race, gender, color, creed, sexual orientation, national origin, or gender identity.”

Turco’s letter said the National Guard will continue to help service members get waivers and exceptions in accordance with federal policy “to support accession and retention of the best qualified individuals in our military force regardless of their gender identity.”

Turco’s letter, dated Tuesday, was a response to a letter written last month by Sen. Eric Lesser, D-Longmeadow, Rep. Mindy Domb, D-Amherst, and Sen. Julian Cyr, D-Truro, and signed by 62 other legislators.

On April 12, Trump’s policy went into effect banning anyone diagnosed with “gender dysphoria” from serving in the U.S. military. Legal challenges are pending.

Each state has its own National Guard, which is controlled by the governor, although units can be mobilized by the president. Officials in California, New Mexico, Nevada, Oregon, Washington state, New Jersey and Colorado have all said their National Guards will continue accepting transgender soldiers.

Baker is a Republican who supports gay rights and signed a state transgender anti-discrimination law. He said in June that he thinks “anybody who wants to serve their country and put themselves in harm’s way should be commended and given the opportunity to serve.” But he said at the time that he was still consulting with Attorney General Maura Healey’s office to figure out what options were available to the state.

Healey has filed court briefs in multiple lawsuits challenging the Trump administration’s ban.

Lesser said in a statement, "We are grateful that the Baker Administration has stepped up to defend the dignity of all our National Guard members, including those who are transgender. Now, we hope that they keep to their word and actively work on behalf of Massachusetts residents to secure waivers from this misguided and malicious federal policy that ignores the advice of our top generals to suit President Trump’s whims.”

Domb said, “I am grateful to the Secretary of Public Safety and Security for their continuing commitment to equality for our transgender neighbors. I so appreciate the strong support of my colleagues and Governor Baker to resist this administration’s mean-spirited, hateful, disrespectful, and divisive policies towards the transgender community.”

This story was updated with comments from Lesser and Domb.