Guardian of Forever

An ancient time portal

An ancient, sentient time portal on a remote planet, through which Kirk and Spock followed McCoy into 1930s New York in The City on the Edge of Forever.

The Guardian of Forever is an ancient portal on a ruined planet, shaped like a large stone ring. It can speak and describes itself as its own beginning and its own ending, and it shows the past of any world like a moving picture, allowing travellers to step into any moment.
In The City on the Edge of Forever, McCoy accidentally overdoses on cordrazine, leaps through the portal and changes history, erasing the Enterprise. Kirk and Spock follow him to New York in the 1930s, where Kirk falls in love with the social worker Edith Keeler. They learn that McCoy saved her life, which lets her peace movement delay America's entry into the Second World War. Kirk has to let her die to restore history.
The Guardian returns in the animated series episode Yesteryear, in which Spock travels to his own childhood. In Discovery's third season, the Guardian appears in the form of a man named Carl and gives Philippa Georgiou a way to escape the illness caused by her displacement in time.