Hello dear @MB,
thanks for sharing your question with the weefugees community.
The Foreigners Office (Ausländerbehörde) is doing it based on, as you have also mentioned it, article article 10 (3) sentence 1 of the residence law of Germany. This article of the residence law states that a foreigner, whose asylum application has been incontestably rejected or who has withdrawn his asylum application may only be granted a residence permit prior to departure in accaordance to the provisions of part 5 of this law. In the part 5 of this law the reasons, based on which a residence permit can be granted, are internation law, political or humanitarian grounds.
The fact that how long this kind of residence permit is issued depends on the art of the case, someone has. I mean, if it ist ssued for political, international law or humanitarian reasons.
You can also read this article of the law and part 5 of this law under the follwoing link in English:
https://***.gesetze-im-internet.de/englisch_aufenthg/englisch_aufenthg.pdf
I hope my answer was useful for you and I'll be very pleased if you contact me again with further questions. I'm a member of the MBEON-staff and I‘ll be glad to guide you over a longer period of time. Mbeon is an online consultancy for migrants via the mbeon-app, which you can install on your smartphone for free. Download it via App Store or Google Play Store. You'll find me In the mbeon-app under my name „München, Herr Noori“ and get confidential one-to-one advice in a safe virtual room where nobody can wiretap messages. Further information: ***.mbeon.de
With kind regards,
Fardeen Noori