A laser system for ophthalmic surgery includes a laser source to produce a surgical pulsed laser beam, an XY scanner to scan the surgical pulsed laser beam in XY transverse directions, a Z scanner, to scan the XY scanned laser beam along a Z axis, an objective, to focus the XYZ scanned beam into a focal spot in a target region, and a computational controller, to use a computational process to control at least one of the Z scanner and the XY scanner, to control an optical distortion of the focused scanned beam.