Image copyright Reuters Image caption Mrs May said she had not been "backwards in coming forwards" at the summit

Theresa May has predicted "difficult moments" ahead in Brexit negotiations but said she is optimistic she can get a deal "that is right for the UK".

Speaking at a summit in Brussels, she said she felt it could be achieved, despite the continuing deadlock over a landmark EU-Canada trade deal .

Mrs May said she had played an active role in discussions and was not "backwards in coming forwards".

It is her first EU summit since she became PM following the Brexit vote.

At a news conference before meeting European Commission President Jean-Claude Juncker for a working lunch, Mrs May said Britain would be "a confident, outward-looking country".

She said she aimed to "cement Britain as a close partner of the EU once we have left", with the country able to control its immigration but trade freely with the EU. She said she would seek a "mature co-operative relationship" with the EU.

Analysis by Laura Kuenssberg, BBC political editor

Theresa May is certainly no stranger to getting things done in Brussels.

And she is rarely, if ever, underprepared, arriving into each meeting clutching her folder with carefully colour-coded and prepared sections.

But can anything have really prepared the prime minister for this summit? She came here promising a "smooth Brexit" but it has been a bumpy affair.

There's been anger in some quarters at her insistence that the UK must still be fully included despite the fact we're leaving. And blunt warnings from other leaders that the negotiations will be very hard going.

The prime minister will hardly be surprised, and she is hardly a delicate flower. As she made clear in the last 24 hours she has "not been backwards at coming forwards". And this was never going to be the summit where any details were discussed or any real progress was made.

But it's abundantly clear now that not only will the process of leaving be difficult, but also that Britain's wishes are simply not a priority in the long drab corridors of the EU Council. Read Laura's full blog

"I recognise the scale of the challenge ahead. I am sure there will be difficult moments - it will require some give and take.

"But I firmly believe that if we approach this in a constructive spirit, as I am, then we can deliver a smooth departure and build a powerful new relationship that works both for the UK and for the countries of the EU, looking for opportunities, not problems."

Asked whether the difficulties over Ceta - an EU-Canada trade deal that has stalled because one Belgian region has objected - might affect a UK post-Brexit deal, Mrs May said she was "not looking to adopt a model that another country has" but was seeking a new relationship with the European Union.

Image copyright AFP Image caption Mr Juncker has suggested his conversations with Mrs May would remain confidential

"Obviously we have got negotiations ahead... those negotiations will take time, as I say, there will be some difficult moments, it will need some give and take but I'm optimistic that we can achieve a deal that is right for the UK because I actually think the deal that is right for the UK will also be right for the European Union."

'Failed model'

But the TUC said the deadlock over Ceta should be a "wake-up call" to ministers.

"Britain will need a trade deal with the EU after Brexit, and it mustn't follow the failed Canadian model," said the union body's general secretary Frances O'Grady.

Media playback is unsupported on your device Media caption Mr Juncker speaks to the BBC about the summit

"We need a new approach to trade that creates good jobs and protects public services and workers' rights. Not one that just prioritises the needs of big business."

Liberal Democrat leader Tim Farron accused the prime minister of a "haphazard" approach to Brexit in her own cabinet.

"Instead of putting the views of a minority of hardline Tory Brexiteers first, our prime minister should be doing what's right for the British people," he said.

"This means remaining in the single market, maintaining cross-border security and ensuring that Brexit leaves nobody worse off."

'English or French'

Meanwhile the man seen as front-runner to replace French President Francois Hollande, Alain Juppe, has said he would revoke a treaty that allows UK border officials to check passports in Calais - known as Le Touquet - should he be elected president next year.

The former French PM blamed the 2003 agreement for the creation of the "Jungle" encampment and said: "We cannot accept making the selection on French territory of people that Britain does or doesn't want. It's up to Britain to do that job."

He added: "A debate must be opened and a new accord obtained with Britain."

And one of the EU's three main Brexit negotiators, Michel Barnier, has been forced to deny claims that he wanted the talks to be conducted largely in French, saying the "linguistic regime" would be decided at the start of official negotiations.

"Never expressed myself on negotiation language," he tweeted. "Work as often in English as French."

Formal exit negotiations will not begin until Mrs May triggers Article 50 of the Lisbon Treaty, something she has said will be done by the end of March 2017.

This means Brexit, backed in a UK-wide referendum in June, is likely to take effect by the summer of 2019.