Earlier this week, a federal appeals court in New Orleans upheld an injunction issued by a federal district court in Texas against the federal government, thereby preventing it from implementing President Barack Obama’s executive orders on immigration. Critics had argued and two federal courts have now agreed that the orders effectively circumvented federal law and were essentially unconstitutional.

Though the injunction on its face restrains officials in the Department of Homeland Security, it is really a restraint on the president himself. Here is the back story.

President Obama has long wished to overhaul the nation’s immigration laws to make it easier for people who are here illegally to remain here and to make it easier for them eventually to acquire the attributes of citizenship. He may have a bighearted moral motivation, or he may have a partisan political motivation. I don’t know which it is, but his motivation has driven him to use extraconstitutional means to achieve his ends.

During his first term in office, he attempted to have federal laws changed -- quite properly at first -- by offering proposals to Congress, which it rejected. That rejection left in place a complex regulatory scheme that is partially administered by DHS and partially by the Department of Justice. It left about 11.3 million people unlawfully present in the United States.

President Obama may have a bighearted moral motivation, or he may have a partisan political motivation. I don’t know which it is, but his motivation has driven him to use extraconstitutional means to achieve his ends.

The conscious decision of Congress not to change the law in the face of such a large number of undocumented people here left those people, adults and children, exposed to deportation. It also left them entitled to financial benefits paid for by the states in which they reside.

Deportation is a lengthy and expensive process. The courts have ruled that all people subject to deportation are entitled to a hearing, with counsel paid for by the government.

If they lose, they are entitled to an appeal, with counsel paid for by the government. The government has teams of prosecutors, defense counsel and judges who address only deportations.

The highest number of people the government has successfully deported in a year is about 250,000, which was done in 2013. If you add removals without trial (many are voluntary) and rejections at the border, the number swells to 438,000 a year.

While awaiting deportation, those people here unlawfully and not confined are entitled to the social safety net that states offer everyone else, as well as the direct benefits states make available to citizens, such as public schooling, access to hospital emergency rooms, and housing and personal living assistance.

Frustrated that Congress thwarted his will, President Obama -- resorting to his now infamous and probably regretted one-liner that he can govern by using a pen and a phone -- issued a series of executive orders in 2012 to various federal agencies, directing them to cease deportation of undocumented people if they complied with certain standards that the president wished of them. The standards, compliance with which would bar deportation, were essentially the same as those that the president had sought and Congress had rejected.

Can the president write his own laws or procedures?

In the litigation that came to a head early this week, 26 states, led by Texas, sued the federal government. In that lawsuit, the states argued that they would be made to endure unbearable financial burdens if the undocumented folks stayed where they are and if the states continued to make the same social safety net available to them as they make available to their lawful residents. Thus, the states argued, the president forced the states to spend money they hadn’t budgeted or collected to support a legal scheme that Congress had not only never authorized but expressly rejected.

Can the president write his own laws and procedures?

The states also argued in their lawsuit that if the DHS and DOJ complied with the president’s executive orders, those federal departments would be exceeding their authority under the statutes because the president was exceeding his authority. This is a president who has argued dozens of times in public that he is not a king and that he lacks the ability to recast the laws as he wishes they had been written.

Can the president write his own laws and procedures?

In a word: No. The president can issue executive orders to officials in the executive branch of government directing those officials to enforce the laws as the president wishes them to be enforced -- within the letter and spirit of those laws. But those executive orders cannot write new laws or revise old laws or ignore existing laws that the Congress clearly expects to be enforced. That is just what a federal district court judge ruled earlier this year and just what a federal appellate court ruled in affirming the district court earlier this week.

All people who embrace the rule of law -- whether they are for open borders or for an impenetrable border wall -- should embrace these rulings because they keep the president within the confines of the Constitution, which he has sworn to uphold.

Under our constitutional system of supposedly limited government, all legislative power is vested in Congress. The president enforces the laws; he doesn’t write them. His oath of office commits him to preserve, protect and defend the Constitution, and it further commits him to enforce the federal laws "faithfully" -- meaning whether he personally agrees with them or not.

The clash between the president and the courts is as old as our republic itself. Courts are traditionally loath to interfere with the business of Congress or the president. Yet when the behavior of another branch of government defies core constitutional norms, it is the duty of the courts in a case properly before them to say what the Constitution means and to order compliance with it.

Andrew P. Napolitano, a former judge of the Superior Court of New Jersey, is the senior judicial analyst at Fox News Channel.