The mayor of Charlotte, N.C. -- the state's largest city and the site of the 2012 Democratic National Convention -- resigned Wednesday hours after he was charged with federal public corruption and accused of taking bribes in an FBI sting.

City spokesman Keith Richardson said Mayor Patrick Cannon submitted his resignation letter Wednesday to the city manager and attorney.

The 47-year-old Cannon is accused of accepting more than $48,000 in bribes from undercover FBI agents posing as businessmen who wanted to do work with Charlotte.

A criminal complaint from the U.S. Attorney says the Democrat, who has been mayor for six months, accepted cash, airline tickets, a hotel room and the use of a luxury apartment as bribes and solicited more than $1 million more.

During the last encounter, according to the U.S. attorney's office, he accepted $20,000 in cash.

Cannon says in the letter that the pending charges will create too much of a distraction for the business of the city to go forward

According to the U.S. attorney's office, the FBI first learned that he may have been involved in illegal activities years ago and started an investigation in 2010.

During the course of that probe, the mayor allegedly accepted bribes from undercover FBI agents on five separate occasions, in exchange for access to city officials responsible for planning, zoning and permitting.

If convicted on all the charges, he faces 20 years in prison and more than $1 million in fines.

Cannon was elected mayor in November, replacing Anthony Foxx. Foxx was named Transportation Secretary by President Obama.

Cannon was first elected to City Council in 1993. He is also longtime radio show host who discusses local and national politics. In November, he defeated Republican challenger Edwin Peacock.

Cannon was also accused of accepting $12,500 from an undercover agent to help him develop a feminine hygiene product called "Hers" to be marketed and sold in the United States. In exchange, Cannon offered to help the undercover agent -- posing as a business manager for a venture capital company -- get the necessary permits to open a nightclub.

During the meeting, an undercover agent told Cannon: "You know, again whatever you can do to get our application moved up towards the top, uh, business license and things like that, that we need."

According to the complaint, Cannon responded: "Yeah, not a problem."

The Associated Press contributed to this report.