If at the end of the 3-month period it is considered likely that detention criteria are still fulfilled, new recommendations MII and MIII are filed and the renewed detention is then valid for 6 months. However, this second period of detention has to be immediately confirmed by a local administrative court.
That's one part of the solution; whether it works is left as an exercise to the reader ..