A top military official has said there will be “no modification” to the military's transgender policy after President Donald Trump announced a ban on transgender service via Twitter.

"There will be no modifications to the current policy until the President's direction has been received by the Secretary of Defense and the Secretary has issued implementation guidance," General Joseph Dunford, chairman of the Joint Chiefs of Staff, wrote in a message to military leaders.

He added: "In the meantime, we will continue to treat all of our personnel with respect.”

Mr Trump sparked outcry on Wednesday when he tweeted that the US government would not “accept or allow Transgender individuals to serve in any capacity in the U.S. Military”.

The announcement seemed to take the Pentagon by surprise, despite Mr Trump’s claims that he consulted with “generals and military experts”. Sources told Buzzfeed that many at the Pentagon watched Mr Trump’s tweets roll out in suspense, fearing he was preparing to announce military action against North Korea. The Pentagon directed all requests for comment to the White House.

General Mark Milley, the chief of staff of the US Army, said on Thursday he had no advance knowledge of Mr Trump's decision. He added that was not unusual.

"I personally did not, but nor would I have expected to," Milley said while speaking at the National Press Club.

At a press briefing on Wednesday afternoon, Press Secretary Sarah Huckabee Sanders said the White House had not determined what would happen to the more than 2,500 transgender people serving on active duty in the US military.

“Implementation policy is going to be something that the White House and the Department of Defense have to work together to lawfully determine,” she said, adding that the Department of Defense would “keep you posted as that takes place”.

Pressed for more detail on the policy, Ms Huckabee Sanders threatened to shut the press briefing down.

Thousands march against Donald Trump in LGBT rights parade Show all 8 1 /8 Thousands march against Donald Trump in LGBT rights parade Thousands march against Donald Trump in LGBT rights parade A marcher hold a sign that reads "Love is Love is Love" on the National Mall with the Washington Monument in the background during the Equality March for Unity and Pride in Washington AP Thousands march against Donald Trump in LGBT rights parade Marchers unfurl a huge rainbow flag as they prepare to march in the Equality March for Unity and Pride in Washington AP Thousands march against Donald Trump in LGBT rights parade Marchers gather to hear speakers at the end of the Los Angeles LGBTQ #ResistMarch AP Thousands march against Donald Trump in LGBT rights parade Gil Mendez, of San Francisco, holds a sign to honor the victims of the shooting at the Pulse Nightclub in Orlando as he marches during the Equality March for Unity and Pride in Washington AP Thousands march against Donald Trump in LGBT rights parade An demonstrator looks on as LGBT members and their supporters take part of the Equality March for Unity AFP/Getty Images Thousands march against Donald Trump in LGBT rights parade A marcher listens to speakers at the end of the Los Angeles LGBTQ #ResistMarch AP Thousands march against Donald Trump in LGBT rights parade LGBT members and their supporters take part of the Equality March for Unity AFP/Getty Images Thousands march against Donald Trump in LGBT rights parade A marcher mugs for the camera during the Los Angeles LGBTQ #ResistMarch AP

Mr Trump’s decision ends an Obama-era policy that sought to fully integrate the military by June of 2017. The policy was to be rolled out in waves, first allowing current transgender service members to serve openly and receive medical care.

The Trump administration was in the process of considering the final wave – allowing new transgender recruits to enlist – when Mr Trump made his announcement.

Defense Secretary James Mattis was troubled by the surprise announcement, according to Politico. Sources said he felt no need to rush to a decision, and was awaiting the results of an extensive Defense Department policy review. He had recently requested six more months to consider the roll-out.

Tony Johnson, a national security researcher and former Pentagon adviser, predicted the decision would not go over well with the larger military community, either.