It was an unfortunately necessary military strategy. At that point in the war the US was afraid of its ally the Russians as much as it needed to end the war with the Japanese. Pretty much all the major players at that point were at least considering nuclear weapons or had some sort of nuclear program, so they knew how difficult they were to manufacture. The second bomb implied that the US had a stockpile of nuclear weapons well before anyone else even had one. In reality it would have taken many months to manufacture additional weapons.