On 8 June 2004, the United Nations Security Council resolution 1546 was adopted unanimously, calling for "the end of the occupation and the assumption of full responsibility and authority by a fully sovereign and independent Interim Government of Iraq by 30 June 2004."
The transfer of sovereignty actually took place a day or two ahead of schedule. Though resulting in the legal return of sovereignty to an Iraqi-led governing force and technically ending the occupation, practical responsibilities continue to be handed over by the multinational force in Iraq.
After major combat operations ended, US President George W. Bush set up the Coalition Provisional Authority (CPA) and led by United States civilian administrator Paul Bremer. On July 22, 2003, the CPA formed the Iraqi Governing Council. The council created a provisional constitution guaranteeing freedom of religion but also forbidding any law to be created that violates the principles of Islam.
The multinational forces set June 30 as the deadline for transferring power back to the Iraqis. As the deadline loomed, fighting increased, with various local insurgents trying to grab power away from the national council and (presumably) prevent Iraq from becoming a sovereign republic. Instability, resentment, and a vacuum of legitimate power resulting from the occupation encouraged some militants from neighboring countries to join in the fight. Washington Times reporter Rowan Scarborough wrote, "Foreign fighters from Syria have become a major stumbling block to stabilizing Iraq and turning over sovereignty by June 30".  On 8 June 2004, the United Nations Security Council resolution 1546 was adopted unanimously and the transfer took place a day or two ahead of schedule.
On January 30, 2005, Iraq's first post-war democratic elections were held, without much violence. These elections created the Iraqi National Assembly, which in April 2005 appointed a new administration, including President Jalal Talabani and Prime Minister Ibrahim al-Jaafari. The US administration has repeatedly claimed that they would leave the country if asked to do so by the Iraqi leadership.  Talabani stated that improvements in the strength of Iraq's own army could enable US troop reductions of up to 50,000 by the end of 2005, though he later backtracked from that claim. 
Under United Nations Security Council Resolution 1790, the mandate of the multinational force in Iraq was extended until December 31, 2008, after which there is no justification for foreign militaries to remain in the country. On June 6, 2008, the Independent reported that the United States was applying pressure to the government of Iraq to sign a "strategic alliance" (not a "treaty", which would require approval of the US senate), giving US forces broad freedom in continuing to operate in Iraq.
Supporters of the Iraq war tend to agree with the view that Iraq regained its sovereignty in June 2004, and that the occupation has thus ended. These advocates regard the insurgents as rebels against the Iraqi authorities. Some opponents of the war regard the continued presence of the multinational forces in Iraq as constituting an occupation.
Accordingly, they describe the insurgents in positive terms as "resistance" fighters whose main aim is to expel the foreign forces.  Critics may make comparisons to the Vichy regime in France and the 1980s Kremlin-backed regime in Soviet-occupied Afghanistan (which was considered a puppet regime by Britain and America, who backed mujahadeen guerrillas against the Russians and Afghan regime forces). These claims would be disputed by those who consider Iraq is now sovereign.
- Patrick Cockburn: "US issues threat to Iraq’s $50bn foreign reserves in military deal", The Independent, June 6, 2008.