Virgil Earp was the Marshal of Tombstone on Oct 26, 1881, the date of the Gunfight at the OK Corral. The Wikipedia link for the gunfight labels him as such in fact, in the caption under his photo.
The link below details how he came to be Marshal:
https://en.wikipedia.org/wiki/Virgil_Earp
In his capacity as marshal he deputized his brother Morgan for permanent special duty a month before the gunfight. He temporarily deputized his brother Wyatt and Doc Holliday just before the gunfight. (Members of quickly formed posses and the like were "temporarily" deputized to enable them to legally perform arrests and defend themselves.) Wyatt had previously served a short time as a Deputy Sheriff for a county that at that time included Tombstone, but he never held a permanent Tombstone City position. It was Johnny Behan who replaced Wyatt as County Deputy Sheriff when the post was contested by vote, breaking a promise of a job for Wyatt in exchange for bowing out, and this led to enmity between them.
Virgil Earp was also the Deputy U.S. Marshal for the Arizona Territory for the area including Tombstone at the time of the gunfight. After Virgil's wounding during an assassination attempt 2 months after OK Corral, both Wyatt and Morgan were named Deputy U.S. Marshals for the territory. Morgan was assassinated shortly thereafter.