Brazil's ex-President Luiz Inacio Lula da Silva has vowed to fight allegations that he was involved in a huge bribery scheme run by oil giant Petrobras.
"I fear nothing," he said, after being interrogated on Friday over allegations that he received millions of dollars in illegal payments.
Lula, a left-wing icon, left office in 2011. His Workers' Party has been hit hard by the long-running scandal.
His brief detention led to clashes outside his home near Sao Paulo.
After his interrogation Lula told reporters he was the victim of a "prejudice as a working-class man", adding: "I escaped death from hunger when I was five... I was the best president to govern this country, the poorest of this country re-elected me because they could eat now."
He also said there had been no need for police to detain him. "If they wanted to hear from me, they only had to call and I would have gone, because I owe nothing to anyone and fear nothing."
This was echoed by his successor, current President Dilma Rousseff, who said it had been "unnecessary" to take him into custody.
The Petrobras inquiry, known as Operation Car Wash, has led to criminal proceedings against dozens of business executives and Workers' Party figures accused of taking part in the multibillion-dollar corruption scheme.
The Workers' Party has held the Brazilian presidency since 2003, both under Lula and Ms Rousseff.
In the latest operations, police enforced 33 search and 11 detention warrants in the states of Rio de Janeiro, Sao Paulo and Bahia, officials said.
Lula, 70, is suspected of receiving about 30m reais ($8m; £5.6m) in speaking fees and donations to his charity, the Lula Institute.
His home in Sao Bernardo do Campo was among the premises targeted, as was the headquarters of the institute in Sao Paulo.
Prosecutor Carlos Fernando dos Santos Lima said: "Among the five largest donors to the Lula Institute, 60% of all the donations were paid by the five largest businessmen involved in the Car Wash scandal."
A police statement quoted by Reuters news agency said: "There is evidence that the crimes enriched him and financed electoral campaigns and the treasury of his political group."
However, no charges have been brought against Lula so far.
The institute said in a statement (in Portuguese) the "violence" against the former president was "arbitrary, illegal and unjustifiable", as he had been co-operating with the investigations.
The Workers' Party called the operation a "political spectacle".
What next? BBC's Daniel Gallas, in Sao Paulo
There is much more at stake in these investigations than just Lula's personal reputation. His legacy and the future of his political project for Brazil - which has shaped the country for the past 14 years - are also under scrutiny.
Under his Workers' Party, Brazil has seen a period of spectacular economic growth and a fall in inequality.
And now, under the same party, the country is facing its worst recession in 25 years; critics point to the government's mistakes for creating the crisis.
Lula has said he is prepared to run for president in 2018. However, in order for his political project to survive, he will have to clear his name and his party's. His detention is a major obstacle in his path.
Markets in Brazil reacted strongly to the news. The value of the Brazilian currency, the real, surged 3% in the morning. Sao Paulo's main stock exchange index rose more than 4% in the initial hours of trading.
Dozens of Lula supporters and opponents gathered outside his home following the raids. There were clashes as both shouted slogans either for or against the former president.
Demonstrators also scuffled outside the police station where Lula was questioned.
'Search for the truth' - Brazilian media, from BBC Monitoring
Operation Car Wash, or Lava Jato in Portuguese, as the corruption investigation is known, has been closely monitored by Brazilian media over the past two years.
Many TV networks are providing live coverage from outside Lula's apartment, where protesters have gathered.
And articles reflecting what the detention means are starting to appear. One of the many headlines in the popular daily Folha de Sao Paulo quotes an opposition figure as saying: "Operations in Lula's house could be the beginning of the end".
Several newspapers are highlighting the nickname of this new phase of the investigation: "Aletheia" is a Greek word meaning "search for truth".
A popular figure
Lula led Brazil during a time of rapid economic growth and is credited with lifting millions of people out of poverty.
He is still a well-liked figure and has been considered a potential candidate in presidential elections in 2018.
But his popularity has been hit by recent allegations that he either had knowledge or involvement in the wrongdoings.
The corruption scandal threatens the government of Ms Rousseff, who has faced repeated impeachment calls. She too has denied having any knowledge of wrongdoings.