It’s finally happening. Gandalf is going to marry Captain Jean-Luc Picard. Or, to put that in more precisely: Ian McKellen, best known for playing Magneto in the “X-Men” films and Gandalf in “The Lord of the Rings,” has agreed to officiate at the wedding of Patrick Stewart, Professor X in “X-Men” and Captain Picard in “Star Trek: The Next Generation.”

"I'm going to marry Patrick," said McKellen, who is gay. “No, no. How else do you put that? I'm going to officiate at his wedding."

When asked how exactly McKellen would obtain the credentials necessary to officiate a wedding, he replied that he wasn’t sure of the details, but that he would work it out soon.

"I don't know,” McKellen said. “But in Massachusetts, in the middle of America somewhere, you get anybody along, a friend, and I read out the words, and Sunny and Patrick will then be married. I declare you man and wife."

The LA Times notes that McKellen officiating at Stewart’s wedding is entirely within reason. The state of Massachusetts offers a “one-day marriage designation” for $25 and a character reference. There are other ways for McKellen to preside over the wedding as well.

There’s precedent for McKellen to take this approach as well. In 2011, Conan O’Brien became ordained by the Universal Life Church in order to officiate at the same-sex wedding of his costume designer and his partner in New York City. Conan stated that the process behind the wedding was almost entirely painless.

No matter which way does it, it won’t be the first time McKellen has officiated at a wedding. In Britain, the veteran actor married a same-sex couple and found it incredibly moving.

"I've done it once before with two guys having a civil partnership," he said. "I was crying my eyes out."

Finally, McKellen had one final piece of practical advice about dressing properly for a wedding ceremony.

"You mustn't upstage the bride," he stated.

McKellen and Stewart will appear together next year in the next X-Men film, “X-Men: Days of Future Past,” which hits theaters on July 18.

Watch the full video of McKellen’s appearance on “The Jonathan Ross Show” below. His remarks’ on Patrick Stewart’s wedding begin at about 10:40.