MOSCOW — Russia has signed a treaty to incorporate Crimea into its territory following a referendum in which residents of Ukraine’s region overwhelmingly backed the move.

President Vladimir Putin signed the document Tuesday with Crimea’s prime minister and parliament speaker following a televised address to the nation, in which he vigorously defended Crimea’s vote as a restoration of historical justice.

The agreement has to be endorsed by Russia’s Constitutional Court and ratified by both houses of parliament to take effect. Those steps are considered mere formalities.

Putin has accused the West of encouraging unrest in Ukraine in order to break its historic ties with Russia, and dismissed Western criticism of the Crimean vote as illegitimate.