Whether the PayPal module redirects a customer to the PayPal payment gateway before or after the order has been created?

See the stack trace here: How is a new order number is generated while placing an order?