Trying to find the title of a book I read once... - eviltoast

OK, y’all. I’m trying to find a book I read many moons ago. I feel like it was by Diana Wynne Jones, but it’s not in her bibliography. Massive spoilers incoming, obviously, but I can’t remember what the spoilers are for.


The book starts on an island nation in the south of the world, with a rigid code of conduct which one of the main characters is being disciplined for breaking. The main characters leave on a quest to the oppressive and powerful kingdom in the north, and its revealed that one of the other main characters is the crown prince of the evil kingdom in the north, and can use their magic. If I recall correctly, his use of that magic makes dark veins stand out under his skin, and he has to fight against it controlling him. There’s some kind of time limit, I think if he uses the magic too much, it’ll take him over and he’ll become the new ruler.

To gain some advantage over the evil kingdom, they visit an abandoned city, break into some kind of temple, and have an encounter with some kind of deity, which might then take over one of the characters?

Later in the story they make it to the evil palace, and there’s a plotline about multiple children of the evil king trying to kill this guy, so they can inherit the throne. I think the evil palace is embedded in a mountain somehow.

Anyone who can set me on the right track, it’d be much appreciated!