Optical generation of intense ultrashort magnetic pulses at the nanoscale