WASHINGTON — Throughout 2016, both Donald J. Trump and President Vladimir V. Putin complained that American-led sanctions against Russia were the biggest irritant in the plummeting relations between the two superpowers. And the current investigations, which have cast a shadow over Mr. Trump’s first six months in office, have focused on whether a series of contacts between Mr. Trump’s inner circle and Russians were partly about constructing deals to get those penalties lifted.

Now it is clear that those sanctions not only are staying in place, but are about to be modestly expanded — exactly the outcome the two presidents sought to avoid.

How that happened is a story of two global leaders overplaying their hands.

Mr. Putin is beginning to pay a price for what John O. Brennan, the former C.I.A. director, described last week as the Russian president’s fateful decision last summer to try to use stolen computer data to support Mr. Trump’s candidacy. For his part, Mr. Trump ignited the movement in Congress by repeatedly casting doubt on that intelligence finding, then fueled it by confirming revelation after revelation about previously denied contacts between his inner circle and a parade of Russians.

If approved by Congress this week, Mr. Trump has little choice, his aides acknowledge, but to sign the toughened sanctions legislation that he desperately wanted to see defeated.