President Donald Trump came so close to getting the facts right in his latest attack on a court whose decision he did not like.

In a series of tweets posted Wednesday morning, Trump slammed a federal court’s decision to block his effort to withhold federal funds from “sanctuary cities,” or cities that refuse to enforce certain aspects of immigration law. Problem is, the president went after the wrong court.

First the Ninth Circuit rules against the ban & now it hits again on sanctuary cities-both ridiculous rulings. See you in the Supreme Court! — Donald J. Trump (@realDonaldTrump) April 26, 2017

Out of our very big country, with many choices, does everyone notice that both the "ban" case and now the "sanctuary" case is brought in … — Donald J. Trump (@realDonaldTrump) April 26, 2017

…the Ninth Circuit, which has a terrible record of being overturned (close to 80%). They used to call this "judge shopping!" Messy system. — Donald J. Trump (@realDonaldTrump) April 26, 2017

The court that issued the decision was not the 9th Circuit Court of Appeals; it was the U.S. District Court for the Northern District of California in San Francisco. As Politico reports, the 9th Circuit will be the next court to rule on Trump’s executive order as the legal battle continues.

Although the judge who issued the order, Judge William H. Orrick, does not sit on the 9th circuit, some people do refer to all courts within the 9th circuit as the “9th circuit.” Trump did, however, correctly claim that 9th Circuit Court of Appeals decisions are overturned “close to” 80 percent of the time—but that only refers to the appeals court, not to all 9th circuit courts and not to the Northern District court. It’s confusing, we know.

Just 97 days into his presidency, Trump already has a tumultuous relationship with the 9th Circuit Court of Appeals, which upheld a block on the president’s original temporary travel ban on citizens of seven Muslim-majority countries. The 9th Circuit court is set to rule on Trump’s second attempt at the travel ban, which was blocked by a judge in Hawaii whom Attorney General Jeff Sessions recently disparaged. That hearing is expected to begin in May.