Melton was given a six-month suspended sentence on each count, one year probation on each count and fined a total of $1,500.
The first-term mayor was accused of carrying a gun onto the campus of the Mississippi College School of Law on Feb. 28, a felony. He also was accused of two felony counts of carrying a concealed weapon into a church.
Under state law, a felony conviction would have forced Melton from office and could have sent him to prison for as long as three years.
Melton stood and acknowledged the agreement more than 90 minutes after the scheduled start of his trial. A jury had been selected on Tuesday.
The former Jackson television station executive and one-time state drug enforcement agency chief was elected on a tough-on-crime platform. He has drawn national attention for his unconventional leadership style — including taking part in police raids and roadblocks — in the city of 184,000, which has a crime rate nearly twice the national average.
Melton was indicted Sept. 15 by a grand jury convened specifically to hear evidence brought by Mississippi Attorney General Jim Hood and Hinds County District Attorney Faye Peterson.
Peterson later brought unrelated charges against Melton and his two Police Department bodyguards for their alleged role in smashing up a duplex on Aug. 26. Melton has said the home was a drug haven, an allegation the property owners deny. They also have filed a lawsuit against Melton.
A trial is pending in those cases.
The American Civil Liberties Union had accused Melton, who is black, of civil rights violations, including racial profiling.
He was elected mayor with 88 percent of the vote in 2005.