New York State is providing $500,000 in grants to Long Island municipalities and other groups to help stop the spread of a fast-moving, invasive forest pest that has killed thousands of pine trees in the two years since it was discovered here.

The Southern Pine Beetle Community Recovery Grant program, announced by Gov. Andrew M. Cuomo on Wednesday, is aimed at helping with the cost of cutting down trees infested with the southern pine beetle.

The pest largely attacks pitch pines, such as those that make up Long Island’s Pine Barrens. Since it was first confirmed on Long Island in the fall of 2014, it has been found on a variety of federal, state, local and private lands — mostly in Suffolk County.

Forest managers say the most effective way to stop the beetle is by cutting down infested trees and a buffer of healthy trees.

But at issue has been how to pay for the suppression efforts. Cutting trees can be an expensive proposition; last year, the state Department of Environmental Conservation estimated suppressing the beetle on Long Island for one year could cost about $3.1 million.

The grants announced Wednesday will provide between $25,000 to $75,000 to municipalities, municipal corporations, soil and water conservation districts, school districts and community colleges, according to a news release from Cuomo’s office. The money is to be used to cut down trees, remove dead ones, or plant new trees to replace the ones killed by the beetle.

advertisement | advertise on newsday

The localities are required to provide a 25 percent local match and must apply for the grants by Aug. 31. The grant money will come from the state’s Environmental Protection Fund.

“New Yorkers have a strong connection to their environment, which on Long Island is being threatened by an influx of invasive species, such as the southern pine beetle,” Cuomo said in a statement. “This funding will help in this administration’s ongoing efforts to stop these infestations and help preserve Long Island’s environmental treasures for future generations.”

So far, the DEC has cut down more than 8,500 trees on Long Island to deal with the outbreak of the beetle.

Earlier this year, the DEC — aiming to find a cost-effective way to remove more infested trees and thin state forests to help them resist the beetle — put more than 4,000 trees in the Rocky Point Pine Barrens State Forest up for sale to loggers.

The effort, which would have been the first sale of trees in a Long Island state forest since the DEC was created in 1970 — garnered no bids.

This year, state Assemb. Steve Englebright (D-Setauket), Assemb. Fred Thiele (I-Sag Harbor) and state Sen. Kenneth LaValle (R-Port Jefferson) asked Cuomo for $3.5 million in the state budget to help suppress the beetle on Long Island.

In a statement accompanying Cuomo’s news release Wednesday, Englebright, the chair of the Assembly’s Environmental Conservation Committee, praised the new grant program as “a good first step in helping to protect the Long Island Pine Barrens,” adding: “I look forward to continuing to work with Gov. Cuomo to ensure that southern pine beetle eradication efforts receive the financial resources they need.”