WARSAW (Reuters) - Poland's ruling PiS party and President Andrzej Duda say they are closer to a compromise on overhauling the judiciary, an issue that has divided the once close political allies and worried the European Union.

In July Duda, who was backed by PiS, the Law and Justice party, in the 2015 presidential election, unexpectedly vetoed the ruling party's judicial reform proposals following nationwide protests and warnings from Poland's Western allies about politicisation of the courts.

The veto raised questions about whether PiS would uphold its support for Duda in the next presidential election.

In September the president made counter-proposals which still envisaged greater political control over the courts but to be exercised by the president and not by the justice minister, as well as parliament.

Lawmakers from both PiS and opposition parties criticised the president's proposals, but since then Duda and PiS leader Jaroslaw Kaczynski have met to discuss the reform, struggling to reach a compromise.

After the latest meeting, which ended on Friday, representatives of both sides said compromise was nearing.

"Law and Justice has made huge concessions when it comes to the judiciary reform. (...) I think that we are close to an agreement," a PiS spokeswoman told broadcasters.

She added that PiS agreed on Duda's proposal that parliament will need a three-fifths majority to appoint new top judges as well as to reduce the influence of the justice minister on courts.

Duda's top aide Krzysztof Szczerski was quoted as saying by the state-run news agency PAP that the meeting with Kaczynski was "a step towards achieving a shared, compromise version of the judiciary reforms within the boundaries of the bills recently submitted to parliament by the president".