MOSCOW — President Vladimir Putin of Russia on Friday formally completed the annexation of Crimea, signing into law bills passed by parliament reclaiming the contested province from Ukraine. Hours earlier, the acting prime minister of Ukraine signed a political association agreement with the European Union, a pact bitterly opposed by Moscow and whose rejection in November led to the overthrow in February of the Ukrainian president.

As he cemented Russian control of Crimea, Putin declared a temporary cease-fire in a tit-for-tat battle of economic and political sanctions between Moscow and the West.

The European Union and the United States have frozen assets and limited travel of a number of close associates of Putin for their part in Crimea’s annexation.

Putin responded to the moves by banning nine U.S. officials and legislators from Moscow. But on Friday he said he did not see the immediate need for further reprisals, while leaving open the door for future retaliation.

Save 75% on a Digital Subscription Today

Putin, meeting with members of his national security council, suggested in televised remarks that the government was still coming to grips with the impact of the sanctions, which targeted 20 people, including senior government officials and businessmen who have grown rich since Putin came to power more than 14 years ago.

Some of those attending the meeting were among those targeted, including Putin’s chief of staff, Sergei B. Ivanov.

“We should distance ourselves from them,” Putin joked, his face showing no emotion. “They compromise us.”

Putin was speaking as the upper house of the Russian parliament, the Federation Council, ratified a treaty signed this week to formally annex Crimea. The lower house, the Duma, took a similar step Thursday, and Putin was to take the final step by signing the treaty later Friday, ending a breathtaking six days of maneuvers that began with a hastily-arranged referendum among Crimeans, who voted overwhelmingly in favor of secession Sunday.

The formalities of Crimea’s annexation followed a stealthy and audacious campaign by Russian special forces to take over military installations, effectively forcing the Ukrainian authorities to capitulate by signaling the withdrawal of their 25,000 troops and dependents from Crimea.

The agreement signed in Brussels by interim Prime Minister Arseniy P. Yatsenyuk was part of an earlier deal abandoned by the deposed president, Viktor Yanukovych, in favor of a bailout by Russia. His action helped precipitate his downfall after weeks of protests in central Kiev.