What's small, yellow, loves bananas and promotes the rule of law? A Minion, at least according to an edited version of the latest animated film featuring supervillain Gru and his army of tiny sidekicks being screened in China.

The fifth instalment of the lucrative "Despicable Me" franchise, "Minions: The Rise of Gru", premiered in China this month, several weeks after the film opened in United States cinemas.

But while the international version of the kung fu-filled family-friendly romp set in 1970s San Francisco tells the story of how the dastardly Gru cut his teeth as a tween criminal, filmgoers in China are treated to an alternative ending in which the good guys win.

A series of subtitled still images inserted into the credits sequence on mainland Chinese screens reassures audiences that police catch Gru's law-breaking mentor Wild Knuckles and lock him up for 20 years after a failed heist.

International viewers simply see Knuckles give police the slip by faking his death earlier in the film's concluding scenes, but in the Chinese version he puts his con artist skills to positive use in prison, where he follows his "love of acting" and sets up a theatrical troupe.

As for Gru, he "eventually became one of the good guys", devoted to raising his family, the Chinese ending says.

It is not the first time a popular foreign film has been altered for cinemas in China, where the entertainment industry faces some of the world's strictest censorship rules and is tasked with promoting "healthy" values.

David Fincher's 1999 cult classic "Fight Club" starring Brad Pitt and Edward Norton was given similar treatment when Chinese streaming platform Tencent Video in January uploaded a version where police shut down the protagonist's plan to bring down modern civilisation.

And the highly anticipated return of US sitcom "Friends" to Chinese streaming platforms in February prompted fury among fans after viewers noticed a LGBTQ plotline was cut.

It is unclear if the "Minions" ending was altered due to censors' demands or if producers considered it a more palatable conclusion for the Chinese market.

Universal did not immediately respond to AFP's request for comment.

Social media reaction to the Chinese "Minions" ending was mixed, with one person on the Twitter-like Weibo social media platform saying they had gone to the cinema specifically to see the new ending but was disappointed that it was "just subtitles".

Other fans were upset by the discontinuity between young Gru's virtuous transformation in the new film, a prequel, and his continued villainous behaviour in the other films, set in the present day.

"We can only say that the Gru of the main films lives in another parallel Minion universe," one Weibo user complained.