Portugal's former centre-left PM, Jose Socrates, has been remanded in custody on suspicion of corruption, tax fraud and money laundering.
Mr Socrates, 57, was detained on his return from Paris on Friday and has already spent three nights in jail.
The judge delivered the decision after investigators looked into suspicious money transfers and banking operations.
Mr Socrates, who denies any wrongdoing, is being investigated alongside his driver, a close friend, and a lawyer.
The former prime minister was in office from 2005 to 2011. His lawyer, Joao Araujo, told reporters on Monday that his client would appeal against the decision.
Under the Portuguese system, formal charges only come at the end of an investigation which could last up to eight months, says the BBC's Alison Roberts in Lisbon.
Portuguese politics was already reeling after the resignation of Interior Minister Miguel Macedo in the wake of a separate corruption inquiry linked to the allocation of residence permits.
Portugal in shock - by Alison Roberts, BBC News, Lisbon
Jose Socrates' detention has sent shockwaves through the political system. Reports purporting to provide details of the investigation - which is covered by judicial secrecy - have swirled since Friday night, when the news broke. They focus on Mr Socrates' supposedly lavish lifestyle in Paris, where he moved after stepping down in 2011.
In past interviews, he has denied anything untoward about his finances.
His detention - on arrival at Lisbon airport, rather than at his flat, and with photographers present - prompted some prominent Socialists to argue it was to divert attention from suspicions of corruption in the right-of-centre government's "golden visa" programme, which fast-tracks residence for foreign investors.
The Socialists' newly elected leader, Antonio Costa, a minister under Mr Socrates, was until now expected to sweep to victory in next year's general election following years of austerity. He is conscious of the perils of the situation.
Because the case surrounding Mr Socrates comes under judicial secrecy, few details have been confirmed.
It is unclear whether the inquiry relates to his time in office. However, Portuguese media has reported allegations that his driver Joao Perna made a number of trips transporting cash to Paris, where Mr Socrates has been working in a new role at a pharmaceutical company.
One of Mr Socrates' long-time friends, Carlos Santos Silva, is being questioned along with lawyer Goncalo Trindade Ferreira.
Two of the suspects are also being held on remand, while a fourth has been barred from foreign travel.
Centre-right Prime Minister Pedro Passos Coelho said the case involved law rather than politics, adding that "Portugal has strong institutions that work".
But the investigation has rocked Mr Socrates' Socialists, now led by Lisbon Mayor Antonio Costa who was elected as secretary-general of the party on Saturday.
Mr Socrates resigned in 2011 in the midst of Portugal's mounting debt crisis. The Socialists are currently leading in opinion polls and Mr Costa said on Saturday that "we mustn't let personal feelings of solidarity and friendship impede the political action of the (party)".