SAN FRANCISCO – Google will pay a $7 million fine to settle a multistate investigation into a snoopy software program that enabled the Internet search leader to intercept emails, passwords and other sensitive information sent several years ago over unprotected wireless networks in neighborhoods across the world.

The agreement announced Tuesday covers 38 states, including Maine, and the District of Columbia, part of the area where households and local merchants unwittingly had some of their communications on Wi-Fi networks snatched by Google Inc. from early 2008 until the spring of 2010.

Google stopped the data collection in May 2010, shortly before the company revealed cars taking street-level photos for its online mapping service also had been grabbing information transmitted over Wi-Fi networks that had been set up in homes and businesses without requiring a password to gain access.

The company blamed the intrusion on an unidentified rogue engineer who rigged a data-collection program into equipment that was supposed to only detect basic information about local Wi-Fi networks to help plot the locations of people using its mapping service and other products. After concluding its own investigation, the Federal Communications Commission last year asserted that some of Google’s managers knew about the engineer’s plan to vacuum information being transmitted over the Wi-Fi networks.

The surveillance triggered outrage among privacy watchdogs and government probes in more than a dozen countries. The backlash so far has been more of a public relations blow than a financial setback for Google, which has embraced “Don’t Be Evil” as its corporate motto.

Even as it repeatedly apologized for a breach of online etiquette, Google insisted that it didn’t break any laws in the U.S. The company is maintaining that position in the multistate investigation by entering into a settlement that doesn’t include any admission of wrongdoing.

The multistate agreement requires Google, based in Mountain View, Calif., to destroy the personal data that it collected from the Wi-FI networks, unless a lawsuit or other legal action requires the information to be preserved. A series of class-action suits is still being appealed in San Francisco federal court.

Google says it never looked at the data.