Enforcing only the parts of laws that you like or you find politically convenient can start verging on tyranny.

On Obamacare, as on immigration enforcement and welfare requirements, Barack Obama is following the course that cost King James II his throne. He is dispensing with the law.

James II was ousted in the Glorious Revolution of 1688-89, in large part for claiming that he could in particular cases dispense with — that is, ignore — an act of Parliament. (Shameless plug: Readers who want more information on this can consult my 2007 book, “Our First Revolution: The Remarkable British Upheaval that Inspired America’s Founding Fathers.”)

The law in question was the Test Act of 1673, which required that all government officials and military officers be members of the Church of England.

It is not a law admired by Americans today or, for that matter, by our Founding Fathers. Article VI of the Constitution provides that “no religious test shall ever be required as a qualification to any office or public trust under the United States.”

But the Founders did follow the English Bill of Rights of 1689, which stated “that the pretended power of dispensing with the laws, or the execution of the law by regal authority, as it hath been assumed and exercised of late, is illegal.”

That seems to be the clear purport of Article II, Section 3 of the Constitution, which requires that the president “shall take care that the laws be faithfully executed.”

But the former constitutional law teacher now in the White House seems to be ignoring that duty.

Last week, a blog post by the assistant secretary of the treasury for tax policy announced that the government would not enforce Obamacare’s employer mandate, the penalty for not offering health insurance to full-time employees.

That announcement appeared the day before the Fourth of July. On July 5, the Department of Health and Human Services issued a 606-page regulation announcing that state health exchanges would not verify the eligibility of those applying for Obamacare health insurance subsidies.

Both decisions go against the letter of the law — in this case, a law that the president and his critics consider the chief domestic accomplishment of his administration.

They follow the decision of the administration that insurance subsidies will be available in states that have chosen to have the federal government run their health insurance exchanges — even though the text of Obamacare authorizes such payments only for states that create their own exchanges.

Now there is an argument that the executive branch has some discretion in enforcing the law. Prosecutors, for example, are not obliged to bring criminal charges in every case where there’s evidence that someone broke the law.

Such an argument might be made about the president’s declaration that the administration not deport “dreamers” — persons brought to the United States illegally as children who have done well in school or served in the military.

But that argument doesn’t apply to the Obamacare dispensations. They’re not examples of taking individual situations into account. They’re general rules that apply to everybody in the stated categories.

Dispensing with the rules is a game that can be played by two. What if, as American Commitment’s Phil Kerpen suggested, a President Mitt Romney decided to dispense with all the provisions of Obamacare?

Or what if another Republican president instructed the Internal Revenue Service not to collect income taxes over 35 percent of adjusted gross income? Enforcing only the parts of laws that you like or you find politically convenient can start verging on tyranny.

That’s what the English came to think back in 1688. King James believed in the divine right of kings and governed for several years without Parliament.

But in time, he forfeited the trust of both Whigs and Tories (yes, there was polarized politics back then, too). When William of Orange came over the Channel with an army, James fled the country.

Obama does not face a similar fate. But his unwillingness to faithfully execute his own signature law is a confession of incompetence — the incompetence of the architects of Obamacare, the incompetence of Obama administrators, even the incompetence of government generally.

It erodes the president’s political capital. House Republicans may block an immigration bill because they fear Obama would not enforce its border security provisions.

For now, Obama’s dispensing is getting pushback from Congress and could be challenged in the courts. And more voters may come to believe that they’d like to dispense with Obamacare.

Michael Barone, senior political analyst for The Washington Examiner, is a resident fellow at the American Enterprise Institute, a Fox News Channel contributor, and a co-author of The Almanac of American Politics.