Uganda has warned that caught wearing a red beret could be prosecuted under military law and sent to prison for life.

The red beret is part of the uniform worn by Ugandan pop star Bobi Wine who is also a challenger for the presidency. His supporters often wear the red beret as a show of support.

The government outlawed the red berets and other pieces of military wear in a gazette declaring them "property of the state."

"The dress code for the UPDF (Uganda People's Defence Force) has been gazetted. The action was endorsed by the top organs of the army which also commended the dress committee for concluding the task assigned to it years back," army spokesman Richard Karemire said in a statement on Monday.

"It manifests the commitment to define identity and outlook of a professional army as well as adhering to the EAC (East African Community) protocols," he added.

But Wine is not buying their reasoning for the unprecedented ban.

"This beret ban is a sham. It is a blatant attempt to suffocate a successful threat to the autocratic status quo," Wine said in a statement.

"But People Power is more than a red beret, we are bigger than our symbol," the statement continued. "We are a booming political movement fighting for the future of Uganda, and we will continue our struggle for democracy."

Wine, whose real name is Robert Kyagulanyi, is seen as a legitimate threat to President Yoweri Museveni's reign of power since he became a legislator back in 2017. Museveni has spent more than three decades in power.

According to reports, authorities have broken up Wine's rallies with tear gas and live rounds and some of his supporters have already been thrown in jail.