The use of the atomic bomb

Was the use of the atomic bomb necessary, or was Japan already
essentially defeated?