A Spanish priest jailed by the Vatican for leaking secret files to journalists was released from custody early on Tuesday on the orders of Pope Francis.

Spanish monsignor Lucio Vallejo Balda was sentenced to 18 months in July after the controversial “Vatileaks II” trial of himself, his assistant, two investigative Italian journalists and a PR consultant.

The case centred on the documents used by the journalists for books exposing waste and financial mismanagement at the top of the church.

The journalists and assistant were acquitted, but PR expert Francesca Chaouqui, who was accused of orchestrating the leaks from a financial reform commission, was given a suspended sentence.

“Given that the Rev Vallejo Balda has already served more than half of his sentence (including pre-trial custody), the holy father Francis has granted him the benefit of a conditional release,” the Vatican said in a statement.

“This is a clemency measure which allows him to regain his freedom. The penalty is not quashed … ” the statement said.

The Vatican said Balda could leave custody on Tuesday evening, that all his professional ties to the Holy See would cease immediately and he would go back to being under the authority of the Bishop of Astorga in Spain, his original diocese.

The revelations at the centre of the Vatileaks affair were embarrassing for the Church but the trial of Vallejo Balda quickly came to be seen as a spectacular own goal.

As well as ensuring repeated discussion of the original details of some cardinals’ luxurious tastes, the trial also heard evidence about backstabbing and plotting within the Vatican.

Balda admitted leaking the classified documents but claimed he had only done so under pressure from his co-accused Chaouqui, after she supposedly made advances to him that culminated in a “compromising” encounter in a hotel room.

She denied the claim and depicted her onetime friend and colleague as a delusional homosexual.

The church meanwhile came under fire from press freedom groups for pursuing the prosecution of journalists under draconian legislation rushed onto the Holy See statute book after the first Vatileaks scandal, which centred on revelations by former pope Benedict XVI’s butler.

The trial also had a surreal air at times with several witnesses testifying that Chaouqui boasted of having close ties to the Italian secret services.

And one monsignor, Alfredo Abbondi, was forced to defend a decision to organise a terrace cocktail party during the canonisation of Pope Jean-Paul II, telling the court it had been a “religious event with nothing worldly about it”.