While campaigning for the Illinois U.S. Senate sear in 2004, Obama expressed support for DOMA, telling a group called Independent Voters of Illinois -- Independent Precinct Organization that he favored the law.
He later switched to an anti-DOMA position on Feb. 11, 2004, as the Illinois Democratic primary drew near. According to Obama's staff at the time, Obama changed positions mid-campaign because he heard from gay friends about how hurtful DOMA was.
As a candidate for president, Obama said DOMA was "was an unnecessary imposition on what had been the traditional rules governing marriage and how states interact on the issues of marriage." His campaign website stated that he supported the complete repeal of DOMA.
"Federal law should not discriminate in any way against gay and lesbian couples," he said, "which is precisely what DOMA does."
Five states -- Massachusetts, Iowa, Connecticut , Vermont and New Hampshire -- and the District of Columbia currently perform same-sex marriages. Four states recognize marriages performed elsewhere, and nine states grant civil unions or partnerships.
ABC News' Jake Tapper contributed to this report.