WASHINGTON—Alleged Sept. 11 mastermind Khalid Sheikh Mohammed has opened the door to helping victims of the terrorist attacks in their lawsuit against Saudi Arabia if the U.S. government spares him the death penalty at a Guantanamo Bay military commission, according to court documents.

Mohammed’s offer was disclosed in a Friday filing in the victims’ federal lawsuit in New York, which accuses the Saudi government of helping coordinate the 2001 suicide attacks. Nearly 3,000 people were killed when terrorists crashed hijacked...