[Read more on Roger Stone’s sentence being commuted by President Trump.]

WASHINGTON — For nearly 50 years, Roger J. Stone Jr. taunted the political gods of fate, unleashing a torrent of dirty tricks on behalf of President Trump and his other well-connected clients and daring his adversaries to come after him, certain that the pursuit would make him richer and famous.

On Thursday, history may have finally caught up with him. But as is often the case with Mr. Stone, there may be an escape clause.

In a Washington courtroom, the dapper Republican political consultant — who once declared, “I revel in your hatred, because if I weren’t effective, you wouldn’t hate me” — was sentenced to more than three years in prison for trying to help Mr. Trump dodge accusations that his 2016 campaign conspired with the Russians.

Whether Mr. Stone, 67, will actually spend years behind bars may depend on the durability of his long and tumultuous friendship with Mr. Trump, who strongly hinted on Thursday that he might pardon his on-again, off-again adviser. “I’m going to let this process play out,” Mr. Trump said, but he added that “Roger Stone and everybody has to be treated fairly. This has not been a fair process.”