The Air Force will spend more than $2 million to permanently stop PFAS-contaminated water from flowing off a former Montgomery County base into local waterways, officials said Friday.

The agreement to fund the fix comes after more than two years of requests from local residents and officials to address the highly contaminated water that has flowed off the former Naval Air Station Joint Reserve Base Willow Grove and into local creeks.

Water contamination from PFAS, a family of chemicals that have been linked to health problems, has affected millions of residents nationwide, including thousands in swaths of Bucks and Montgomery Counties. Here, the chemicals ran off the former Willow Grove and Warminster naval bases into waterways and drinking water supplies.

Those have since been cleaned, but contamination remains in groundwater, storm water, and other parts of the environment. Across the country, the military has responded differently at various bases and has been pressed by affected states for more funding and cleanup.

“For years, we have been deeply concerned by the ongoing contamination flowing from the Willow Grove base and into our region’s groundwater,” said U.S. Rep. Madeleine Dean, the Democrat representing Montgomery County, who had lobbied the military to address the issue and announced the Air Force funding on Friday.

It could take up to two years to build the containment and filtration system, which is being designed by the Warminster Municipal Authority, said Timothy Hagey, the authority’s general manager. The final design is in progress, and it will collect and treat the ground and surface water before it flows off the base.

“We would like to get it done as soon as we can,” Hagey said Friday.

The municipal authority has shown a preliminary design to the Air Force; a final design will take six months to complete, he said. Actual construction will take a year, plus time for bidding, approvals, and permits.

The system will collect and treat the water and is slated to be designed to treat 500 gallons a minute, which, along with improvements to an existing retention basin, would handle “most, if not all, rain events," Hagey said.

The Air Force disbursed $2.8 million for the project, Dean’s office said; Air Force spokespeople confirmed the anticipated cost is more than $2 million.

For years, the water has been moving off the Willow Grove base and into a tributary of Park Creek, which eventually flows into Neshaminy Creek — which goes into the Horsham-area water treatment facilities.

“Today, we are a step closer to cleaning up our region’s drinking water,” Dean said.