ISTANBUL, Turkey — A court in southwestern Turkey handed down life sentences on Wednesday to 40 men, including senior military officers, for trying to assassinate President Recep Tayyip Erdogan. It was the first high-profile verdict against those accused of plotting to overthrow him in a failed coup attempt last year.

The defendants, who included senior military officers and men from Turkish special forces and combat search-and-rescue units, were accused of mounting a helicopter raid on a luxury hotel in the resort town of Marmaris, where Mr. Erdogan was vacationing with his family.

The trial is one of over 40 mass proceedings being conducted around the country against people suspected of participating in the coup attempt on July 15, 2016. The plotters used helicopters, tanks and air force jets to bomb institutions, including the Parliament. Two hundred and forty-nine people were killed in the bloody effort to seize power.

The attempt failed when Mr. Erdogan evaded capture and rallied supporters onto the streets to face down the coup. Loyal military officers also resisted.