President Donald Trump pardoned former Arizona sheriff and anti-immigration figurehead Joe Arpaio, who stood to face jail time after being convicted in July of being in contempt of court for continuing to engage in aggressive anti-immigration enforcement after a 2011 court order demanded he stop the practice. The pardon, issued late on on Friday night, was widely seen as a concession to the immigration hardliners who comprised Trump’s early base — as well as a remarkably tone-deaf decision in the wake of the violence of Charlottesville.

But according to reports by The Washington Post’s Philip Rucker and Ellen Nakashima and The New York Times’ Maggie Haberman, Trump’s interest in pardoning Arpaio dates back several months. According to several unnamed administration officials familiar with the case, Trump asked both attorney general Jeff Sessions and White House counsel Donald F. McGahn II whether he had any legal avenue to help Arpaio, who had at that point been charged but not yet convicted. Sessions and McGahn both informed Trump that he could not wipe away the charges prior to conviction, but reassured him that he had a wide remit to grant pardons at his pleasure. Arpaio was convicted in July.

In a statement quoted by The Times, White House Press Secretary Sarah Huckabee Sanders said: “It’s only natural the president would have a discussion with administration lawyers about legal matters. This case would be no different.”

Trump’s decision to pardon Arpaio has come under fire from legal scholars, who point out that Trump is, essentially, allowing a government official to defy Constitutional rights with impunity.

Yet Trump’s decision should hardly be seen as surprising. Rather, it reflects his priorities: rewarding those he sees as loyal and punishing those like special prosecutor on the Russia investigation Robert Mueller, whom Trump has reportedly looked into firing. When judicial norms — or the rule of law — threaten to limit Trump’s actions, they can be safely disregarded. As Slate’s Michael Joseph Stern writes:

Arpaio’s conviction was a test for how long and how willing Trump will be to abide judicial oversight. He flunked it. It now seems clear that many future beneficiaries of the president’s clemency will be his political allies—and that he might not wait to for them to be convicted or sentenced before issuing a pardon. Trump, in other words, may use his pardon power to stymie Robert Mueller’s investigation, as well as other inquiries into the past misdeeds of his associates.

How the Russia investigation plays out remains to be seen. But Trump’s pardon of Arpaio is a troubling test case for Trump’s values.