BEIJING — After losing out on his love interest, a wild elephant has turned his attention to cars.

The elephant wandered out of a nature reserve in southern China on Friday following a failed courtship and started playing with cars parked along a highway, slightly damaging more than a dozen vehicles, authorities said.

The government of Xishuangbanna prefecture said that the animal had recently lost to another male elephant in a battle for the affections of a female, and that his temperament was moody. Staff at the nature reserve thought the animal might have become playful at the sight of the cars, the government said in a posting on its social media account.

The elephant did not hurt any of the tourists who had crowded the area during the Lunar New Year holiday, and who were very excited to see the elephant, the government said. The animal’s public appearance lasted about 20 minutes before he returned to the nature reserve.

“The tourists were quite excited to see a real wild elephant, and they were using their cellphones to take photos and videos,” the government said. “Even the owners of some damaged cars found the experience to be thrilling and very interesting, although their cars got scraped.”

The owners of the 15 cars that were damaged by the elephant will be compensated, the government said.