Offenders can get their sentences reduced if they volunteer to help fill sandbags.
The unusual approach to criminal justice is happening in Arkansas in the USA.
Faulkner County and Conway District Court Judge Chris says anyone who is on misdemeanour probation or owes community work service to the Faulkner County District Court can receive double credit for helping Faulkner County fill sandbags amid fears the Arkansas river will flood.
Arkansas borders states including Oklahoma, Mississippi, Texas, Missouri, Louisiana and Tennessee – a giant swathe of the country which has suffered terribly from severe flooding in recent months.
Some homes in Mississippi have been flooded since February and it could be weeks to months before the waters recede, according to emergency officials.
News website the Mississippi Clarion Ledger reports that an estimated 544,000 acres are submerged, 515 homes damaged and hundreds of businesses suffering from the flooding.
Mississippi Governor Phil Bryant says the damage could be in the tens of millions of dollars and describes the disaster as "historic" – possibly worse than the great flood of 1927.
He said: "The 1927 flood was a line of demarcation for most of us who live in the Delta. This may replace that. This is indeed the great flood of Mississippi."
Alternative sandbags called FloodSax (www.floodsax.us.com) are widely used in the USA. They are really quick and easy to store and deploy and inflate on contact with water to become even better than traditional sandbags at keeping floodwater out. More than 2.5 million FloodSax have now been sold worldwide.