LONDON — In one of the most consequential diplomatic events in Britain since World War II, Prime Minister Theresa May on Wednesday sent formal notice of the country’s intention to withdraw from the European Union, starting a tortuous two-year divorce littered with pitfalls for both sides.

Mrs. May said in Parliament that she was invoking Article 50 of the Lisbon Treaty, putting Britain on track to leave the European Union in 2019 and raising a host of thorny issues involved in untangling a four-decade relationship.

In addition to a welter of trade and customs matters, the Conservative government faces the prospect of a new independence referendum in Scotland, where a majority voted to remain in the European Union, and deep worries about the 1998 Good Friday peace agreement in Northern Ireland.

Just before 12:30 p.m., Britain’s top envoy to the European Union, Tim Barrow, walked to the office of Donald Tusk, the president of the European Council, and handed him a letter with the official notification. Mr. Tusk then posted on Twitter acknowledging receipt of the letter.