When house hunting, the price of homeowners insurance probably isn't top of mind. But homes with hidden risks can make getting coverage difficult, expensive or both. Learning how to identify them could save you a bundle.

This could be a particularly important concern for first-time home buyers and those moving from cities to suburban or rural areas who may not be aware of common hazards, said Jennifer Naughton, risk consulting officer for insurer North America for Chubb.

A homeowners insurance premium can depend in part on distance to the nearest fire hydrant and fire station, Naughton said. Homes that are on narrow roads or otherwise difficult for fire trucks to access also could be more expensive to insure.

"If they have to cross over a bridge, it's not only a consideration of can a car go over that bridge but also can a fire engine," she said.

Some homes are at such high risk of wildfires and severe weather that private companies won't insure them. Without insurance, you can't get a mortgage, so you would need to turn to costly state-run risk pools.

Talking to the neighbors and a local insurance agent can give you a better idea of what costs you might face.

Getting coverage for an older house with outdated wiring, heating systems or plumbing can be a challenge as well because of the risk of fire or water damage, which costs insurers and homeowners billions of dollars a year.

Home buyers may be able to lower their insurance costs by updating those systems and by installing water sensors or a whole-house monitoring system, which can range from $600 to several thousand dollars, she said.

Flood risk is also a concern, Naughton said. Flooding isn't covered by regular homeowners insurance policies, and typically only homes in the highest-risk zones are required by mortgage lenders to buy special flood policies. But the federal government's flood maps may understate the risk to many properties

Again, talking to the neighbors and a local insurance agent can help you assess the potential costs.

The U.S. Geological Survey said 16 states are at high risk for a damaging earthquake in the next half-century: Alaska, Arkansas, California, Hawaii, Idaho, Illinois, Kentucky, Missouri, Montana, Nevada, Oregon, South Carolina, Tennessee, Utah, Washington and Wyoming. Earthquakes are another hazard excluded from homeowners policies, although some private insurers offer coverage.

Liz Weston is a writer at NerdWallet. E-mail: lweston@nerdwallet.com. Twitter: @lizweston.