His economic strategy has gone up in smoke and so have crucial relationships in Europe. Violent urban disorder erupted on his watch over the summer and scandal forced the resignation of a key member of the cabinet in the autumn. The northern part of his kingdom is threatening to break away. His closeness to senior members of the Murdoch empire has been a serial, personal embarrassment. On a core element of the government's domestic programme – the NHS legislation – the prime minister has been forced into reverses which cost political capital without doing anything to reduce the risk that it will turn into a terrible mess.

And yet David Cameron ends the year on something of a high. His backbenchers greeted his return from Brussels with a hero's welcome. He may eventually come to rue raising expectations that he cannot ultimately fulfil, but for the moment he has won what one influential Tory MP calls "a breathing space" with his party during which "we will get off his back about Europe". He squelched Ed Miliband at the last Prime Minister's Questions of the year. Despite a bleak economic outlook, accompanied by the worst unemployment figures in 17 years, some polling has the Conservatives nudging ahead of Labour. The languishing Lib Dems are reduced to sighing with relief when they can just squeak a third place in a byelection. Giddier Tory MPs can even be heard speculating about engineering a snap general election. That is silly chatter, but the fact that it is talked about at all is indicative of the state of play as we come to the close of this turbulent year: David Cameron is on top.

This is not because the prime minister has had 12 months which deserve the description brilliant. In many respects, it has been a year which has exposed a variety of flaws, limitations and contradictions in both his personal style and political strategy. The "big society", which was once to be his governing theme, is rarely heard of these days. Even he appears to have given up making speeches trying to sell it. His premiership is becoming defined by austerity and Europe, the opposite of what he originally intended.

Yet he remains ascendant. That is because all politics is relative. One reason he seems to be in a good place for a prime minister is because international rivals and domestic competitors are in much worse ones. He leads a government which looks unusually robust when set beside many others. Rancour between Tories and Lib Dems is as nothing compared with the poisonous divisions in the US where government is paralysed by the deadlock between the White House and an obstructionist Congress. Whatever its faults, Britain's coalition can pass a budget and enact legislation. Greece and Italy have "technocratic" governments – in other words, governments that no one voted for – imposed on them by the failure of conventional democratic politics and the terror of the bond markets. I have lost count of the number of summits at which Nicolas Sarkozy and Angela Merkel met to resolve the euro crisis and then failed to do so.

George Osborne has been forced to rewrite his deficit reduction strategy, an event that ought to be a humiliation for a chancellor. A mere 18 months after he vaingloriously proclaimed that he would have the job done in a parliament, he now promises a diet of gruel into the foreseeable future. But the markets have continued to tolerate the size of Britain's debts, and most voters continue to buy the prime minister's excuses, because this government seems more decisive and stable than most.

On the domestic front, too, David Cameron is flattered by comparisons. He basks in the reflected failure of others. After Ed Miliband's latest belly flop, one Tory MP, not normally a cruel man, chortled to me that the Labour leader "is the gift that keeps on giving". Labour is having a renewed bout of jitters about its leadership and long-term prospects without evincing any serious sign that it knows how to enhance either.

The Lib Dems are furious but trapped. Nick Clegg only learnt of the denouement of the Brussels summit in a four-in-the-morning call from David Cameron after the fact. Many Lib Dems see this as the second serious betrayal of the year, the first one being Mr Cameron breaking a "gentlemen's agreement" over the conduct of the AV referendum when he licensed the "No" campaign to launch personal attacks on the Lib Dem leader. Lesson for Mr Clegg and his party: if you are going to strike a "gentlemen's agreement" be first sure that the other party is actually a gentleman. Angry as they may be, the Lib Dems have nowhere to go when collapsing the coalition and triggering a sudden election would be the proverbial turkey voting for an early Christmas.

No figure within his own party has the stature or popularity to threaten David Cameron at present. He is not constantly menaced by an internal rival in the way that Tony Blair was by Gordon Brown.

This is not entirely healthy because it exacerbates an already established tendency to be complacently insouciant at times. He has shown himself to be cavalier and careless: at home over the NHS reforms and abroad when he failed to cultivate any allies before the Brussels summit. In a speech on Friday, the prime minister called himself a "vaguely practising" Christian. Senior civil servants and colleagues sometimes wonder whether he is not also a "vaguely practising" prime minister.

On other occasions, he has shown a capacity to rise to events with clarity and boldness. He took a riskily forward position in the early stages of the Libyan crisis, insisting that a UN mandate for action could be secured when many doubted it and pushing for military intervention against considerable initial resistance from both other governments and his own officialdom and military.

To Tories of a Eurosceptic bent, which is to say nearly all of them these days, his other demonstration of boldness was to say no to a new European treaty. This is much more arguable. It was a decision not so much willed as forced upon him by the refusal of every other European leader to indulge Britain's demands and the pressure from his MPs, 81 of whom had earlier rebelled over a referendum on withdrawal, and many more of whom were with the mutineers in spirit if not in the division lobby.

One theme that has emerged over the past 12 months is that David Cameron is not very good at relationships; certainly not at some kinds of crucial relationships. He has mismanaged both his footsoldiers at home and his international peers. It is admittedly not easy to deal with Nicolas Sarkozy – a volatile grandstander facing a difficult election within months and desperate to divert attention from his own failures and predicaments by abusing the ros beefs. But Mr Cameron ought to be asking himself why he has not got a better relationship with someone as ideologically sympathetic as Angela Merkel and how it was that he found himself without a friend in the room at the Brussels summit. European leaders who normally prefer the British to the French found the approach of Team Cameron arrogant in its assumptions and aloof in its diplomacy.

This, interestingly, echoes the complaint you often hear back home from within his own party. I have spent more lunches and dinners than I care to remember listening to Tory MPs complain about how remote they feel from their leader, often getting on to the subject before the first glass of wine. Now, it is only fair to observe that I have never known a time, whether the prime minister was Tory or Labour, when MPs didn't moan that they were unloved by their leader, especially when the MP in question felt that his talents had been overlooked for a ministerial post. Sensible leaders do something about it. Tony Blair found buttering-up backbenchers a bore so he employed people at Number 10 whose job it was to do it for him. There seems to be no one in David Cameron's Downing Street tasked with party management. Many a Tory MP has a bitter anecdote about an occasion when they or a colleague have felt snubbed by the prime minister or cold-shouldered by his operation. "It will be his downfall in the end," one Conservative MP remarked to me recently.

"Out of touch" and "arrogant" are also the words most often to be heard from focus groups of voters when they are asked to discuss what they don't like about this prime minister. This is not necessarily fatal so long as it is balanced by things they admire. It is certainly better for a leader to be regarded as too confident than the opposite. Similar complaints of arrogance were made about Tony Blair and Margaret Thatcher and both won a hat trick of elections before they were finally undone. For now at least, David Cameron's approval and leadership ratings easily best those of his rivals. "He's not that good," says one senior Labour figure who despairs of his party's failure to capitalise on the coalition's many difficulties. "But Cameron doesn't have to be that good against us."

In politics, you don't need to be the best. You just have to be better than the rest.