Voting to take the UK out of the European Union was the easy bit. Now time for the hard graft as ministers and civil servants work out how to make it happen - with more gain than pain. There are new departments to set up, a negotiating marathon to prepare for and Brexit ministers who reportedly "hate each other".

Theresa May has declared that Brexit means Brexit. The next task for the prime minister and her Brexit team - when Westminster is up and running again next month - is to decide what that means in practice. Then, over to the civil service to deliver whatever vision emerges. Here are a few of the tasks ahead.

Two new departments

Image copyrightGetty ImagesImage caption
David Davis has been appointed Secretary of State for Brexit

Theresa May decided to create two new Whitehall departments to deal with Brexit. So we have the Department for Exiting the European Union - led by David Davis - and the Department for International Trade led by Liam Fox.

Setting up a new government department is textbook stuff for new prime ministers. It's not that they've come up with a new organisational wheeze. It's more a way of communicating political priorities. In Theresa May's case, setting up two Brexit departments is designed to send out the message that she takes the referendum result seriously.

The politics of department-making is well understood by the former civil servant Sir Andrew Cahn. He was once chief executive of UK Trade and Investment which has just been turned into Liam Fox's new department.

But Sir Andrew points out that creating government departments brings "huge frictional costs". He said: "I would not have chosen to set up David Davis's department. Politically it makes a lot of sense but there's a practical price to to pay for it."

Find the staff

Image copyrightPA

With two new departments and a big job to be done, finding enough staff is high on the to-do list for ministers and Whitehall leaders. But there's only so much poaching from other departments - mainly the Foreign Office - to be done.

So a recruitment drive is under way - especially for trade negotiators.

Former head of the civil service, Lord Kerslake, told Civil Service World that departments involved in the UK's relationship with the EU had "all been stripped back" in recent years and that the civil service should "put a stop on haemorrhaging people".

It's a view echoed by the Conservative chairman of the Foreign Affairs Committee, Crispin Blunt, who voted for Brexit. He said: "it's essential there is no penny pinching. The Foreign Office is already more than stretched."

He thinks there are British staff, currently working for the European Commission, who would be "prepared to come back".

But Sir Andrew wonders if it's as simple as that. He reckons there are some "very brilliant negotiators" who could be lured out of retirement but that they are eyed with suspicion because so many were "committed Remainers".

In such a febrile atmosphere Whitehall is likely to recruit some negotiators from other countries.

Harmony between Brexit ministers

Boris Johnson, Liam Fox and David Davis put a lot of effort into telling the British people that Brexit would bring many benefits. They now have to deliver on their promises. That's a lot of pressure. So a few rows are inevitable.

There were newspaper reports earlier this month that Liam Fox wants his Department for International Trade to take over responsibility for negotiating new trade deals. Boris Johnson was said to be unenthusiastic about the idea.

And Conservative MP Tim Loughton has reportedly told political comedian Matt Forde that the three men "hate each other". That was swiftly followed by reports that they were having "peace talks"

Crispin Blunt says there is a "certain amount of positioning" going on between the International Trade Department and the Foreign Office as they establish the lines of responsibility.

But he reckons that it's not the "usual game of politics" being played here, saying: "Each of them, I know personally, is seized of the historic importance of the role."

Doing the deal

The civil service has already begun the enormous task of identifying every law that derives from the EU. Once article 50 has been triggered - which formally starts the two-year negotiation process with the EU - the real work starts.

He predicts that Britain's exit from the EU will require at least "six interlocking sets of negotiations".

He says: "If the British government wants the talks to run smoothly, it will need to earn the goodwill not only of the countries in the EU, but also of those in the World Trade Organisation. The Brexit negotiations will take much longer and be far more complicated than many British politicians realise."

The talks will cover these areas:

Britain's legal separation from the EU

A free trade agreement with the EU

Interim cover for the UK between leaving the EU and a free trade agreement coming into force

UK accession to full membership of the World Trade Organisation

new agreements to replace deals that currently link the EU and 53 other countries

Co-operation on foreign, defence and security policies

Sealing the deal

So how long will it all take? Sir Andrew Cahn predicts it could be 2035 - yes, nearly 20 years from now - until satisfactory deals with the EU and other trading partners are done and dusted. By which time, the current Brexit Ministers will be in their seventies and eighties!

Or is it the case that the difficulties you ascribe to a project are related to your enthusiasm for it? Crispin Blunt suggests as much.

He calls talk of difficulties and delay "a type of anxiety attack" by people who do not want to leave the EU.

For his part, he is optimistic that negotiations will start in 2017 and finish in 2019 - the year before a general election.

But those negotiations could end with no deal at all between the UK and the EU.

In those circumstances, Crispin Blunt concludes, the UK would leave the EU and "sell into the single market like any other country".

Sticking to a tight timetable for leaving the EU - with the possibility of no deal - is motivated by the desire among Leavers to stop Brexit being thrown into question again by a second referendum or a general election. As Mr Blunt put it: "There'll be hell to pay if it's reneged on."