WASHINGTON — The Trump administration urged the Supreme Court Thursday to end the six-month legal battle over its immigrant and refugee travel ban by ruling that it's all about national security, not religion.

In an 84-page brief that served as the opening salvo in a Supreme Court case scheduled for oral argument two months from Thursday, the Justice Department argued that Trump's vow to ban Muslims during last year's presidential campaign is legally, if not rhetorically, irrelevant.

"The order’s text and operation are entirely religion-neutral," Acting Solicitor General Jeffrey Wall argued. "The Fourth Circuit (appeals court) erred by discounting those objective indicia of the order’s purpose based largely on campaign statements made by then-candidate Trump before taking office. This court’s precedent prohibits such 'judicial psychoanalysis of a drafter’s heart of hearts.'"

Far more relevant, the government said, is the fact that President Trump was acting in the name of national security.

"The courts of appeals nullified a formal national security directive of the president of the United States acting at the height of his power," the brief contends. "Federal courts may not second-guess the political branches’ decisions to exclude aliens abroad."

The travel ban's challengers, including Hawaii and a coalition of immigrant rights groups, will respond next month as the court showdown approaches. A final decision from the justices isn't expected until next year.

In the meantime, however, the two sides continue to joust in federal appeals court in California over the Supreme Court's orders in June and July that allowed the ban to take effect temporarily, but with exceptions for close relatives of U.S. citizens and for certain refugees. That court has scheduled a hearing for August 28.

More:Trump's travel ban: Where it stands

More:The five-month odyssey of President Trump's travel ban

More:'SEE YOU IN COURT:' Trump's vow proves prophetic

The saga began Jan. 27, when Trump issued an executive order titled "Protecting the Nation from Foreign Terrorist Entry into the United States." It suspended travel from Iran, Iraq, Libya, Somalia, Sudan and Yemen for 90 days, blocked all refugees for 120 days, and suspended travel from Syria indefinitely.

The action led to chaos at airports in the U.S. and overseas, followed within hours by temporary restraining orders and, over the next few weeks, a series of federal court rulings against the ban. As a result, Trump issued a revised version March 6, exempting visa and green card holders and dropping Iraq from the list.

The revisions didn't change Trump's luck in two left-leaning federal appeals courts based in Richmond, Va., and San Francisco. But on the last day of the Supreme Court's term in June, the justices upheld parts of the ban and agreed to consider its overall constitutionality in the fall.

In the meantime, the court said travelers from the six targeted countries can bypass the travel ban and enter the U.S. if they can prove they have a "bona fide" relationship with a U.S. person or entity.

The Trump administration defined that close relationship as immediate relatives, including spouses and spouses-to-be, children and parents. Federal District Court Judge Derrick Watson in Hawaii later ordered the list expanded to include grandparents, grandchildren, aunts, uncles, cousins and in-laws.

The administration also decided that only refugees personally matched with a resettlement agency in the U.S. could enter. But Watson disagreed and ordered officials to allow a broader array of refugees in.

Last month, the justices said the additional relatives deserve entry, but not additional refugees, leaving the appeals court in California to sort out the details.

Trump already appears to have three justices on his side: Conservatives Clarence Thomas, Samuel Alito and Neil Gorsuch would have blocked Watson's ruling from taking effect for both immigrants and refugees, leaving the administration's rules intact.

If the court's four more-liberal justices side with the ban's challengers, the high court's ruling will depend on the votes of Chief Justice John Roberts and Justice Anthony Kennedy.