Ed Miliband has accused David Cameron and other world leaders of failing to stand by Libya, contributing in part to the crisis in the Mediterranean.
The Labour leader said the UK had repeated the same mistakes "in post-conflict planning" for Libya as were made in Iraq and the current refugee situation should have been anticipated.
Conservatives denounced the remarks. Mr Cameron called them "ill-judged".
But Mr Miliband rejected claims he had politicised the issue as "nonsense".
Setting out his foreign policy priorities in a speech in London, Mr Miliband also said Mr Cameron had presided over the "biggest loss of influence in a generation" and placed the UK's future in the European Union in doubt.
The BBC's assistant political editor Norman Smith said Labour were making clear that they were not blaming the prime minister for the recent deaths in the Mediterranean.
But Lib Dem leader Nick Clegg said any suggestion of "political point-scoring" on the back of a "total human tragedy" was "pretty distasteful".
Mr Miliband voted in favour of UN-authorised air strikes against former Libyan leader Muammar al-Gaddafi in 2011, designed to stop the slaughter of Libyan civilians in Benghazi.
The intervention led to the collapse of the Gaddafi regime but the country has descended into chaos since then.
An estimated 800 people died when their boats sank off the Libyan coast on Sunday while more than 35,000 people are thought to have crossed from Africa to Europe this year, many of them being transited through Libya and departing from there.
In a speech in London, the Labour leader suggested that the UK and the wider international community had let Libya down.
Analysis by Peter Hunt, Labour campaign correspondent
It was meant to be about Ed Miliband's vision beyond the purely domestic.
It became, in part, a row over whether or not he was accusing David Cameron of being in some way culpable for the deaths of migrants in the Mediterranean.
First there were the briefings and the counter-briefings by the unelected spin doctors.
Then those seeking elected office weighed in, with Tory representatives accusing Mr Miliband of being absolutely offensive; and their Labour opponents insisting the other side was manufacturing a row.
And all this before the man who wants to govern had uttered a word. And all because of 29 words in bold in a Labour briefing document.
For the Tories, it's been an opportunity, once again, to question whether Ed Miliband has what it takes to be prime minister.
For Labour, it's been a chance to try and portray their leader as a man who'll be at ease representing the UK abroad.
And for the electorate, the speech and the spat have been a reminder that the challenges of Europe, migrants and the so-called Islamic State await whoever occupies No 10 once voters have delivered their verdict.
"David Cameron was wrong to assume that Libya was a country whose institutions could be left to evolve and transform on their own," he said.
"The tragedy is that this could have been anticipated. It should have been avoided.
"And Britain could have played its part in ensuring the international community stood by the people of Libya in practice rather than standing behind the unfounded hopes of potential progress only in principle."
A briefing note released by Labour ahead of the speech sparked a row after it suggested Mr Miliband would say the refugee crisis and tragic scenes in the Mediterranean this week were in part a direct result of the failure of post-conflict planning for Libya.
Asked after his speech whether he was directly pinning the blame on Mr Cameron, Mr Miliband said the Conservatives were trying to "whip up a storm" and his position was "absolutely clear".
He said the deaths were the result of people traffickers, repeating his view that a failure of post-conflict planning was "responsible for some of the situation we see in Libya".
He was later asked during a BBC Radio 1 Newsbeat event why he had not asked about Libya during Prime Minister's Questions for four years. Mr Miliband said he had raised the issue in the Commons in February.
Speaking on a campaign visit to Lincoln, Mr Cameron said leaders needed to demonstrate "clarity, consistency and strength" in the face of a "dangerous and uncertain world".
He added: "People will look at these ill-judged remarks and they will reach their own conclusions."
On Thursday, Mr Cameron pledged UK military assets to boost search and rescue efforts in the Mediterranean after an emergency EU summit, in which leaders agreed to treble funding for search and rescue efforts.
Speaking on Channel 4 News, the PM hit back at claims Libya had been left alone after the military intervention.
He said: "We all pledged, and Britain played its part in trying to train up Libyan security forces. We put aid money into Libya. I don't accept we didn't have a plan - we did."
Speaking on BBC Radio 5 live, Mr Clegg said a considerable amount of thought had gone into how to stabilise Libya after Gaddafi's fall, contrasting this with the aftermath of the 2003 Iraq invasion for which he said there had been "no planning at all".
But he added: "At the end of the day the future of Libya is in the hands of the Libyan people".
Setting out his foreign policy vision, Mr Miliband said he would take a hard-headed approach to foreign intervention, saying it should only happen as a "last resort" and with the support of regional allies.
Former foreign secretary William Hague said the Labour leader "cannot come to foreign policy with some ill-judged and opportunistic remarks after five years of saying very little at all".
The Conservatives say they will "ensure Britain is a major player on the world stage", exerting diplomatic influence through its bilateral alliances and its membership of the UN Security Council and the G7.
In other election news:
- Mr Cameron says proposals for "English votes for English laws" would be in place for the first Budget of a Conservative government
- The Liberal Democrats say either an "ideologically-driven single party government" or an "unstable" alliance would put the economy at risk
- HSBC says it is considering whether to move its global headquarters out of London
- Northern Ireland's Health Minister Jim Wells has apologised for remarks he made during a gay marriage discussion.
- SNP leader Nicola Sturgeon said her party would prop up a minority Labour government even if the Conservatives had a 40-seat lead
* Subscribe to the BBC Election 2015 newsletter to get a round-up of the day's campaign news sent to your inbox every weekday afternoon.