BERLIN (AP) — A descendant of the last German kaiser on Tuesday lost a court bid for the return of a castle overlooking the Rhine valley, part of which has been turned into a hotel.

The largely ruined Rheinfels Castle, which is set high above the most picturesque stretch of the Rhine and was once a property of the Hohenzollern family, has been owned by the town of St. Goar since 1924. A condition set at the time was that the town not sell the castle, failing which the Prussian crown estate administration reserved the right to revoke St. Goar’s ownership.

Prince Georg Friedrich of Prussia, the great-great-grandson of Kaiser Wilhelm II and the current head of the Hohenzollern family, argued that a 1998 agreement under which St. Goar granted the hotel next to the ruins a 99-year leasehold amounted to a sale. But the Koblenz state court rejected his case for the site’s return.

The castle was part of the family property seized by authorities in November 1918, when the German monarchy ended with Wilhelm’s abdication shortly before the end of World War I, and put under a crown estate administration set up by the Prussian finance ministry. That administration then transferred the site’s ownership to St. Goar.

The court found that the castle was transferred to the administration not as the Hohenzollerns’ private property but as a “special asset” of the royal family. That would mean that only the crown estate administration, and not the kaiser or his descendants, could claim back the castle if the conditions of ownership had been breached.

The administration, dissolved in 1927, was a sub-authority of the Prussian finance ministry. The ministry’s powers later went to post-World War II Germany’s states — in this case Rhineland-Palatinate, where Rheinfels is located.