A Mexican poet has been fined about US$5 (€3.25) for desecrating the country's flag by writing a poem about using it to wipe up urine and excrement.

Poet Sergio Witz Rodriguez published the poem in a magazine in the southern state of Campeche in 2000 and could have faced as many as four years in prison under a law protecting the flag and national insignia.

Judge Jose de Jesus Banales said in the ruling that the fine was small, but symbolic: "It will set an example so that people do not abuse freedom of expression, and to discourage anti-social behavior."

The poet on Thursday described the ruling as an attack on freedom of expression and vowed he would not pay.

"It would be like admitting that I am a criminal," Witz Rodriguez said.

Stung by centuries of colonialism and an 1848 defeat by the United States which cost the country half its territory, Mexico has fostered a fervent cult of respect for its flag.

A five-judge panel of Mexico's Supreme Court upheld the law protecting it in 2005, but Witz Rodriguez can still appeal the fine.

His poem rejects nationalist values, with the opening lines: "I / clean my urine / on the flag / of my country / That rag / that dogs lie on / and that represents nothing."

"Since the start of the trial, they have been determined to teach me a lesson, and send a message that in Mexico there are still limits, even on thought," Witz Rodriguez said.