WASHINGTON — It is one thing for a new administration to switch sides in a legal dispute. That is merely unusual. It is another to urge the Supreme Court to deny review in a case that would test whether the government’s new position is correct.

In a Supreme Court brief filed last month, the Justice Department tried to have it both ways. It told the justices that it no longer believed that some federal prisoners serving longer prison terms than the law allowed were entitled to challenge their sentences in court.

For the last 16 years, the Justice Department had taken the opposite view. It said so in at least 11 Supreme Court briefs. You might think the Supreme Court should settle things.

But the department urged the justices to refuse to hear an appeal from Dan C. McCarthan, a Florida man who said he was sentenced to seven more years than the law allowed. It did so even as it acknowledged that the legal question was significant and that the department’s new position could lead to harsh results, condemning inmates to serve out unlawful sentences.