Sodium cyanide is primarily used in gold mining as a leaching agent to extract gold from ore. Its high affinity for gold allows for efficient extraction. However, due to its highly toxic nature, it is handled with extreme care and strict safety measures.