LISBON (Reuters) - Portugal's former premier, Jose Socrates, who has been in jail since November on suspicion of corruption, has refused an offer of house arrest with an ankle monitor and attacked the justice system for trying to cover up errors in his case.

Socrates was arrested and jailed as a preventive measure while an investigation continues into alleged tax fraud and graft. He denies any wrongdoing and calls the case against him an "enormous, cruel injustice."

Prosecutors have not yet presented a formal indictment against him. In a letter, Socrates said his imprisonment was ordered unilaterally despite his denying all accusations. Now that prosecutors need his consent to leave jail for the proposed house arrest, "never could I willingly give it", he wrote.

"These half-freeings have no other goal but to mask the original error and the successive failure - after six months of prison there are no facts, no proof, no charges," he wrote. The house arrest could also be an attempt by the investigators to obtain confessions from him, he added.

A judge has yet to rule whether to send Socrates home to remain under police watch without the ankle monitor, but his lawyer said his client would appeal against such a decision.

His lawyer has appealed the detention on various occasions, but courts confirmed the need for preventive detention. That usually means there is a risk of flight or attempts by the accused to disrupt the investigation. The crime of graft carries a prison term of up to eight years.

The jailing of Socrates, Portugal's Socialist prime minister between 2005 and 2011, was the first involving a former premier in Portugal under democracy. It followed other big cases as prosecutors intensified a fight against corruption in a country notorious for its slow-moving justice system.

His opposition Socialist party is running slightly ahead of the center-right ruling coalition in opinion polls before a parliamentary election due in September or October. But it appears short of enough support to obtain a full majority.

Socrates resigned as prime minister in the middle of his second four-year term in 2011 as an escalating debt crisis forced him to request an international bailout, which imposed painful austerity measures on Portugal.

During his premiership, Socrates weathered several investigations, including allegations that he misused his post as environment minister in 2002 to allow the construction of a shopping mall. He denied wrongdoing and faced no formal charges.

(Reporting By Andrei Khalip; Editing by Larry King)