The Ukrainian parliament has voted for the release from jail of former prime minister Yulia Tymoshenko, a political rival of President Viktor Yanukovich.

The decision to decriminalise the law under which she was imprisoned was voted for in favour by 310 of the 450-strong parliament or Rada.

The decision came as Ukraine's opposition leaders signed an EU-brokered agreement with President Yanukovich to end violence which has gripped the country in recent weeks.

"Free Yulia! Free Yulia!" legislators chanted after the vote.

Tymoshenko, 52, was jailed in 2011 for betraying the national interest in a case that revolved around a controversial gas contract she signed with Russia.

She has long claimed charges were politically motivated.

The EU made her release an essential condition before a trade agreement with Ukraine could be signed.

Protests in Ukraine erupted in November after the parliament rejected another legislation that would have allowed Tymoshenko to walk free and Yanukovich subsequently announced the dismissal of the long-negotiated trade and investment deal with the EU.

Tymoshenko had served twice as prime minister, after taking power with former president Viktor Yushchenko in Ukraine's "Orange Revolution" in 2004.

During her time in office, she worked to loosen Ukraine's ties with Russia and take her country closer to the EU but trouble started when the pro-Moscow government of Yanukovich entered office.