PRAGUE  The European Union has stepped into a dispute between Russia and Ukraine that has drastically reduced energy supplies to the Continent, saying on Wednesday that it had won agreement from Russia and Ukraine for independent monitoring of natural-gas flows through Ukraine.

The pledge, European officials said, should help restore gas supplies to the West, which were entirely halted earlier in the day.

After phone conversations with Prime Minister Vladimir V. Putin of Russia and his Ukrainian counterpart, Yulia V. Tymoshenko, on Wednesday, the European Commission president, José Manuel Barroso, said both leaders had agreed in principle to allow monitors to verify gas movements. But he also warned both countries  and particularly Ukraine  that failure to help restore supplies could have consequences for their relationships with the European Union.

“We have received assurances both from Prime Minister Putin and Prime Minister Tymoshenko that they both accept international monitors,” Mr. Barroso said.