FILE PHOTO: Newly appointed Britain's Secretary of State for International Development Alok Sharma is seen outside Downing Street in London, Britain July 25, 2019. REUTERS/Hannah McKay

LONDON (Reuters) - The British government will comply with the law and is “cautiously optimistic” it will achieve a Brexit deal with the European Union by Oct. 31, cabinet minister Alok Sharma said on Friday.

Prime Minister Boris Johnson has vowed that Britain will leave the European Union on Oct. 31 with or without a divorce deal, but parliament has passed a law to compel him to seek an extension if he has not got an agreement by Oct. 19.

“We are absolutely going to comply with the law, we’re working incredibly hard to get a deal but we will be leaving on the 31st of October,” Sharma, the international development minister, told BBC radio.