Smoking will be prohibited in public housing residences nationwide under a federal rule announced on Wednesday.

Officials with the Department of Housing and Urban Development said that the rule would take effect early next year, but that public housing agencies would have a year and a half to put smoke-free policies in place. The rule will affect more than 1.2 million households, the officials said, although some 200,000 homes already come under smoking bans adopted voluntarily by hundreds of public housing agencies around the country.

The nationwide ban will have its greatest impact in New York, where the New York City Housing Authority — whose 178,000 apartments and more than 400,000 residents make it the largest public housing agency in the United States, has lagged behind many of its counterparts in adopting smoke-free policies. While HUD proposed the sweeping prohibition a year ago, it had been prodding public housing authorities to adopt such policies since 2009.

The New York agency, which had asked HUD unsuccessfully for three years to phase in a ban, issued a statement on Wednesday saying it was “fully committed to providing an environment that promotes resident health as part of our vision of safe, clean and connected communities.”