I recently spoke at the Blue Hill Grange about the future of farming in Maine. I’ve been giving talks on farming for 15 years. But as local interest in farming has grown, my audiences have grown increasingly optimistic. I spoke that night to a crowd who understood how farming could — if Maine is smart in what we do — be a major contributor to our state’s economic future and independence.

Farming in Maine is growing. From 2002 to 2007 (when the last Agricultural Census was released), the number of farms in Maine went from 7,199 to 8,136, a 13 percent increase in just five years. The number of acres in production also went up, by almost 10 percent. Even more recent statistics show that Maine is now leading all New England states in agricultural production. We were in third place not many years ago.

More important, farming here is poised to grow more. Maine has abundant water, good soils, handy access to markets, intact farm infrastructure, and a nice balance between established farmers and young people entering the field.

Consumers, meanwhile, increasingly care about where their food comes from. They are demanding exactly what Maine farmers can provide.

True, some farms are struggling. Dairy farms, for instance, are clearly in crisis. But the primary problem within the dairy sector is a faulty federal pricing system, not Maine’s inability to make milk economically. Federal policy will eventually change. In the meantime, the Maine Legislature helps ease the pain with a landmark program that is the envy of farmers in other dairy states.

Farming in Maine is very different from a generation ago. A given farm may not have changed much, but farming has — often in ways that aren’t readily seen or commonly understood.

Here are some of those changes:

Most of the new farms are small operations serving local markets.

Many Maine farms are now selling locally, not just newly established farms. Indeed, almost all of Maine’s older orchards that remain in business have survived by changing their focus to local markets.

Farms are growing a much broader assortment of products. As a result, local consumers have begun to think differently about what Maine can grow, and this in turn creates even more opportunities for innovative farmers.

Some farms have remained viable by becoming larger. The number of farms over a thousand acres has quadrupled in 20 years. (Even Maine’s largest farms are small compared with what’s common in many other states, however.) Different types of opportunities are emerging for different sized farms. Larger farms serving com-modity markets often grow to capture economies of scale, while smaller farms often diversify and market directly. At present, both strategies work.

Larger farms and smaller farms are interconnected and mutually supportive. Larger farms produce the vast bulk of agricultural goods and are the reason Maine retains milk processors, grain infrastructure, farm equipment dealers and other services that help farms of all sizes. Conversely, larger farms benefit from the renewed public support for agriculture that comes from smaller farms forging such direct links to local consumers.

A different kind of change — no less significant — is a growing appreciation that preserving farmland is critical to keep farming viable. Increasingly, farmers cannot afford to pay a developer’s price for land they intend to work. However, once a farm is preserved through an easement, it sells at its value as farmland, not as future development.

Maine Farmland Trust supports farmers in many ways, but our fastest growing program purchases farms, preserves them with easements and then resells them to farmers at the more affordable “farmland” prices. This enables new farmers to get started, and helps existing farms to expand or secure land they currently lease.

Perhaps the greatest challenge facing farming is that as much as one-third of Maine’s most productive farmland (up to 400,000 acres) will likely change hands in the next 10 years, as aging landowners sell or die. This demographic challenge is coming just as farming in Maine is poised for a renaissance — just as many farmers have embraced exciting new business strategies and many consumers have avidly begun to demand more local foods.

There is great opportunity here — to preserve much of this farmland that will be changing hands, and to continue to put it in the hands of committed farmers. With the right strategies and effort, farming in Maine can blossom.

I looking forward to the day — in another 15 years — when I can talk about Maine’s 25,000 thriving farms.

John Piotti of Unity is executive director of Maine Farmland Trust and the representative for House District 45, which includes part of Waldo County. He has chaired the Legislature’s Agriculture Committee. He is the Democratic candidate for the Maine Senate in District 23.