Former NBA superstar Allen Iverson has returned his kids to their mother ... and insists he was NEVER holding them hostage in the first place ... at least that's what A.I. claimed in court last week.

We broke the story ... Iverson's ex-wife filed court docs insisting Allen had all 5 of their kids holed up at an Atlanta hotel and refused to hand them over to their mother on the designated swap date.

But TMZ has learned ... Allen appeared in Fulton County court in Georgia last Wednesday and told the judge his ex-wife had full access to their kids during their stay at the hotel ... and therefore he wasn't doing anything wrong. We're told Tawanna also testified that she could have picked up the children from Allen but didn't want to drive 45 minutes to his location.

After A.I.'s testimony, the judge decided the former Philadelphia 76ers star didn't deserve to be thrown in jail -- despite his ex-wife's request before the hearing. The kids -- ranging from ages 3 to 16 -- were returned to their mother following the hearing.