Iran says it has canceled a planned $500 million loan to Pakistan to build part of a pipeline to bring natural gas from Iran.

Deputy Oil Minister Ali Majedi says Iran has no obligation to finance the Pakistani side of the project and also doesn't have the money. Majedi's comments were posted on the oil ministry's website, shana.ir, Saturday.

He said Tehran will demand compensation if Islamabad fails to take Iranian gas by end of next year.

Iran's former president Mahmoud Ahmadinejad had pledged the loan.

The Iran-Pakistan pipeline is designed to help Pakistan overcome its mushrooming energy needs. Pakistanis experience frequent blackouts.

But there are serious doubts about how Pakistan could finance the $2 billion needed to construct the pipeline, which also faces U.S. opposition.