CHICAGO — The Chicago City Council, forced by a federal judge to allow gun sales in the city, approved an ordinance Wednesday that dramatically limits where those stores can open and puts owners on alert that the city will be looking over their shoulders every time they sell a gun.

During their discussions, aldermen and Mayor Rahm Emanuel made it clear that the only reason they were voting to permit gun stores after decades of a ban was because a federal judge, following a 2010 U.S. Supreme Court ruling that invalidated the city’s handgun ban, ruled earlier this year that the ban on stores selling guns was unconstitutional.

Aldermen also listed some of the provisions – which will almost certainly trigger a legal challenge – including a requirement that all gun sales be videotaped and another that gun owners open their books for inspection by policeThe gun ordinance also addresses what police and others believe is a big reason for what they say is a flood of illegal guns into Chicago and why the city’s police officers seize more illegal guns than any police department in the United States: The sale of guns by so-called straw purchasers, who then transfer them to people who are not legally allowed to buy and possess firearms.

The ordinance, said Alderman James Balcer, “will now allow employees to be trained so they can identify straw purchasers.”

Further, the ordinance allows buyers to purchase no more than one gun every 30 days – a hindrance, supporters say, on straw purchasers who would prefer to buy several firearms at once.