TC Energy Corp. and the Alberta government late Wednesday announced formal and final termination of the suspended Keystone XL oil export pipeline, but they reserved the right to seek compensation for rejection of the project in the United States.

“An orderly exit” would honor remaining environmental and regulatory commitments, said the Calgary pipeline company and Alberta officials. “The two parties will continue to explore all options to recoup the government’s investment in the project.”

As project leader, TC Energy recorded a C$2.2 billion ($1.8 billion) loss after President Biden kept a 2020 election promise to scrap a permit granted by former President Trump that had allowed Keystone to begin construction.

The formal termination transfers about half the loss to...