Clearing path to new government, judges find no legal justification to prevent PM from leading coalition; say accord ‘raises serious difficulties’ but intervention inappropriate