Much of President Barack Obama’s executive action legacy will be decided by the courts after he leaves office, but he had a rough judicial record while serving.

Though Obama has frequently touted his pen and phone policymaking, these actions on immigration, environmental policy, and presidential appointees have often been swatted away by the Supreme Court.

Sen. Ted Cruz, R-Texas, issued a July 2014 report that found 20 instances in which a unanimous high court ruled against the administration. Not all of these cases were executive actions, but legal interpretations by an agency.

The Obama administration has fared worse before the Supreme Court than any other modern president’s administration, with a 45 percent win rate, according to an analysis by Ilya Shapiro, a fellow in constitutional studies at the libertarian Cato Institute, and editor-in-chief of the Cato Supreme Court Review. Obama’s last five predecessors had a win rate of between 60-75 percent before the high court, according to Shapiro.

“Every president ratchets up executive power, it’s what Congress and the courts have allowed to happen over the years,” Shapiro told The Daily Signal in a phone interview. “President Obama has pushed beyond that in pushing administratively what he failed to do legislatively.”

“This reflects an Obama administration pattern of ignoring the rule of law and usurping the role of Congress,” @AldenAbbott1 says.

The overreach has less to do with Obama—or for that matter any other individual president—and more to do with the expansion of government, said Ilya Somin, a law professor at George Mason University.

“I would not be hugely surprised if he had the most actions overturned because as government gets larger, there are more targets for the courts to shoot at,” Somin told The Daily Signal in a phone interview. “In a sense, each president builds on the precedent of the last president. Presidents are incentivized to take actions like this.”

District and appellate level courts halted many of Obama’s executive actions. Some of Obama’s actions still await a ruling in court, such as his gun control initiative.

“The U.S. Supreme Court and lower federal courts have overturned Obama administration actions that went beyond constitutional and statutory limits at an unprecedented rate, as documented by statistical studies,” Alden Abbott, deputy director of the Meese Center for Legal and Judicial Studies at The Heritage Foundation, told The Daily Signal in an email.

Abbott noted the unanimous rebukes by the high court came at a much higher rate than for previous presidents.

“This reflects an Obama administration pattern of ignoring the rule of law and usurping the role of Congress—as illustrated, for example, in its unauthorized efforts to rewrite the immigration laws and the Obamacare statute without congressional authorization,” Abbott said.

Here are some of Obama’s executive actions knocked down by the judiciary.

1.  Executive Amnesty

In June, the Supreme Court had a tie vote on Obama’s executive actions on immigration. The 4-4 ruling resulted in upholding an appellate court ruling to strike down Obama’s executive amnesty.

Obama’s actions would have shielded 5 million illegal immigrants from deportation. The president took the action in December 2014, shortly after Republicans won control of the Senate.

The move expanded on a previous executive action in 2012 to shield childhood arrivals from deportation. The new edict would extend to the parents of those children.

Texas and 25 other states filed the lawsuit to halt it.

2. School Gender Identity Restrooms Mandate

In August, U.S. District Judge Reed O’Connor of the Northern District of Texas ruled that schools may keep restrooms, locker rooms, and showers separated based on biological gender.

The judge blocked the mandate one day before the first day of school in Texas. The preliminary injunction is in place while the lawsuit proceeds.

The judge determined the Obama administration overreached on its authority by mandating in May that public schools allow people to use restrooms based on their gender identity instead of biological gender. If the schools did not adhere to the rules, they would risk losing their federal education funding.

Texas filed the suit and was joined by 12 other states. This is only the first court hearing and the case will ultimately be decided after Obama leaves office.

3. Appointing Without Confirmation

In a stinging legal defeat for Obama, the Supreme Court ruled that the president cannot make recess appointments when the Senate is still in session. The liberal wing, including Obama nominees Sonia Sotomayor and Elena Kagan, joined the majority for a 9-0 rebuke in June 2014.

Obama made recess appointments to the National Labor Relations Board at a time when the Senate was in pro forma session every three days for the express purpose of preventing recess appointments. The appointments were challenged in a labor dispute, in the case of NLRB v. Noel Canning.

4. Delayed Carbon Regulations

The Supreme Court ruled 5-4 in February to halt the Environmental Protection Agency’s Clean Power Plan from taking effect until the legal challenge is complete. But it’s a setback rather than a death blow to the regulation.

The Court of Appeals for the District of Columbia heard oral arguments in the case, and will likely have the final say when it does rule, at least until the ninth slot on the court is filled.

Numerous industry groups, 25 states, and four state agencies sued the EPA over the rules.

The EPA finalized the plan in October 2015, requiring states to meet individual carbon dioxide emissions reduction goals for power plants by 2022, and again in 2030.

Under the rules, the EPA would offer incentives to states. The incentives include extra credits to meet carbon reduction if a state used more renewable energy sources. It would also offer states the option of imposing a carbon tax or a regional cap-and-trade.

5. Searching Cellphones

The Supreme Court ruled in another unanimous decision that the Obama administration could not search cellphone data without cause, because such a search would be a violation of the Fourth Amendment.

In the case of Riley v. California in June 2014, the high court held that government must get a warrant before searching the contents. The Obama Justice Department contended that an arrest gives authorities the right to search the phone.

The majority opinion said:

Modern cellphones are not just another technological convenience. With all they contain and all they may reveal, they hold for many Americans ‘the privacies of life.’ The fact that technology now allows an individual to carry such information in his hand does not make the information any less worthy of the protection for which the Founders fought.

6. Obamacare Judicial Setback

The Supreme Court has twice upheld Obamacare, either in whole or in part.

However, in a lawsuit brought by the House of Representatives, the law hit a snag in May when U.S. District Judge Rosemary M. Collyer in the District of Columbia ruled the administration has been improperly funding the Obamacare subsidy program.

Though Congress authorized the program, it didn’t appropriate funding for it, Collyer said in her opinion. Former House Speaker John Boehner launched the lawsuit. The House of Representatives v. Burwell case was filed at a time of growing concerns about the Obama administration’s executive overreach on various matters.

The funding program was set up to reimburse insurance companies and provide cost-sharing for low-income patients.

In October 2015, an appeals court similarly ruled on a stay for the EPA’s water rules. The case is on appeal with the U.S. Court of Appeals for the D.C. Circuit, which again, could have the final say if the Supreme Court remains divided 4-4.

7. Regulating Water

The U.S. Court of Appeals for the Sixth Circuit, based in Cincinnati, ruled that the Obama administration’s Waters of the United States rule wasn’t legal, asserting that it clashed with Supreme Court precedent. The EPA unsuccessfully argued that bodies of water could be under federal control because of their connection to larger bodies of water.

The court determined:

A stay allows for a more deliberate determination whether this exercise of executive power, enabled by Congress and explicated by the Supreme Court, is proper under the dictates of federal law …

A stay temporarily silences the whirlwind of confusion that springs from uncertainty about the requirements of the new rule and whether they will survive legal testing. A stay honors the policy of cooperative federalism that informs the Clean Water Act and must attend the shared responsibility for safeguarding the nation’s waters.

Again, this could also be the final say in the matter in lieu of a ninth justice.