The shooting took place at a child's birthday party, Stockton's Vice Mayor Jason Lee said in a Facebook post.
Eastern and northeastern Afghanistan, especially regions along its borders with Uzbekistan, Tajikistan, and Pakistan, are particularly prone to earthquakes.
Authorities said investigations are underway to determine the exact cause of the accident.
The detainee admitted to his actions during interrogation, expressing deep regret and describing his behavior as the result of ignorance.
"As of August 18, 20 people died as a result of the emergency incident," the local emergency service headquarters said in a post on Telegram.