Santa Rosa’s controversial rent control law was defeated this month by just 781 votes out of more than 33,000 cast, according to final results released Friday by Sonoma County election officials.

The most expensive election in the city’s history resulted in 17,163 votes in opposition to Measure C and 16,382 votes in favor. The county reported that the “no” votes amounted to 51.2 percent of the total count, versus 48.8 percent cast in favor of the measure.

Measure C supporters suggested the law, which originally had been passed by a divided City Council, was defeated due to $850,000 raised and spent by rent control opponents, including outside real estate interests,. In contrast, supporters contributed about $170,000 for the Yes on C campaign.

Opponents said voters rejected a poorly crafted approach to deal with the lack of affordable housing in the city, and elected officials now should work to encourage the construction of more homes.