PORTLAND — Housing authorities in Maine will receive nearly $5.2 million in federal funding to improve and preserve public housing, the U.S. Department of Housing and Urban Development announced Thursday.

The funding is part of $1.7 billion in capital fund grants being awarded to housing authorities in all 50 states, HUD said in a press release.

Portland Housing Authority will receive the largest share – about $1.4 million – of Maine’s allocation. The Housing Authority of Bangor will receive about $811,000; the Lewiston Housing Authority will get about $474,000; and the South Portland Housing Authority will get about $391,000.

The remaining funds will be distributed to the 16 other housing authorities in the state.

The annual HUD allocation is intended to make large-scale improvements to public housing units.

There are 1.2 million public housing units in the U.S. that are managed by about 3,100 public housing agencies, HUD said in the release.