MANILA, Philippines — The strongest typhoon to menace the Philippines in recent years was on track to slam ashore today in the northeast, where thousands of villagers fled to safety amid massive emergency preparations.

Millions of residents and rice farmers along the typhoon’s path were warned of pounding rains and fierce wind that could significantly damage agriculture, homes, power and communications.

Typhoon Megi packed sustained winds of 140 miles per hour and gusts of 162 mph, but it could strengthen still before making landfall in Isabela province midday today.

With its ferocious winds and heavy rainfall, Megi has become the most powerful typhoon to threaten the country in four years, government forecasters say. A 2006 howler with 155 mph winds set off mudslides that buried entire villages, killing about 1,000 people.

Weather officials issued the highest of a four-tier public storm alert for the two coastal provinces of Isabela and Cagayan and three mountain provinces where the typhoon is expected to pass before exiting the main northern island of Luzon into the South China Sea.

More than 3,000 people in coastal areas moved to school buildings and town halls that were turned into evacuation centers. Classes and outdoor activities were canceled, and officials advised families to have one person stay awake overnight for any contingency.

Ships and fishing vessels were told to stay in ports, and several domestic flights were canceled.

Thousands of military reserve officers and volunteers were on standby, along with helicopters, including six Chinooks that were committed by U.S. troops holding war exercises with Filipino soldiers near Manila, said Benito Ramos, a top disaster-response official.

Rescue boats and thousands of food packs have been pre-positioned near vulnerable areas, he said.

“This is like preparing for war,” said Ramos, a retired army general. “We know the past lessons, and we’re aiming for zero casualties.”

An angry President Benigno Aquino III fired the head of the weather bureau in July for failing to predict that a typhoon would hit Manila. That storm killed more than 100 people in Manila and outlying provinces.

Weather forecasts said the capital is expected to be spared a direct hit this time, although the lowest weather alert was in effect Monday with preschools closed.

In Cagayan, a vast agricultural valley crisscrossed by rivers and creeks, authorities ordered villagers to move out of high-risk neighborhoods in 12 coastal towns.

“If nobody will budge, we may carry out forced evacuations,” said Bonifacio Cuarteros of the provincial disaster office.

Farmers in Cagayan, a rice- and tobacco-producing region of more than 1 million people about 250 miles northeast of Manila, have been warned to harvest as much of their crops as possible before Typhoon Megi hits or risk losses, Cuarteros said.

With its current course and speed, the typhoon is expected to barrel across the northern tip of Luzon then blow into the South China Sea late today toward northern Vietnam or southern China.

Violent police encounters in California last year led to the deaths of 157 people and six officers, the state attorney general’s office said Thursday in a report that provides the first statewide tally on police use-of-force incidents.