Actor Keegan-Michael Key attends the 18th Annual Post-Golden Globes Party hosted by Warner Bros. Pictures and InStyle at The Beverly Hilton Hotel on January 8, 2017 in Beverly Hills, California.

Actor Keegan-Michael Key attends the 18th Annual Post-Golden Globes Party hosted by Warner Bros. Pictures and InStyle at The Beverly Hilton Hotel on January 8, 2017 in Beverly Hills, California.

*Keegan-Michael Key is taking his talents to the theater.

The actor of “Key & Peele” fame has a plum role in Sam Gold’s staging of Hamlet, which will play off-Broadway at The Public with Oscar Isaac in the title role of the tormented Danish prince.

Key will star as Hamlet’s trusted friend Horatio in the production.

Previews begin June 20, ahead of an official opening on July 13. It will run at The Public’s Anspacher Theater through Sept. 3.

The production was initially set to close the current season at Theatre for a New Audience’s Polonsky Shakespeare Center in Brooklyn.

Roberta Colindrez, Peter Friedman, Gayle Rankin, Matthew Saldivar and Anatol Yusef are also in the production.

Since Comedy Central’s “Key & Peele,” Key has starred in comedies such as “Keanu” and “Why Him?” Among his upcoming films are Shane Black’s “The Predator” and Joe Swanberg’s comedy “Win It All.”