Legal. A1 did not leave the court voluntarily and did not have control of the ball when he/she did. This situation is similar to one in which A1 makes a try from under the basket and momentum carries A1 off the court. If the try is unsuccessful, A1 may come back onto the court and regain control since A1 did not leave the court voluntarily and did not have control of the ball when he/she did.