Image copyright Reuters Image caption Leandra English took legal action after Mick Mulvaney was named as acting agency head

A federal judge has sided with US President Donald Trump in a legal fight over who should run the country's top financial watchdog agency.

Mick Mulvaney will remain as the acting director of the Consumer Financial Protection Bureau (CFPB), US District Judge Timothy Kelly ruled.

CFPB Deputy Director Leandra English filed a lawsuit after Mr Trump named his budget chief to the role.

The power struggle emerged after CFPB's permanent director resigned on Friday.

Outgoing head Richard Cordray, who was appointed by the Obama administration, named Ms English his successor as acting director.

But hours later, Mr Trump named Mr Mulvaney, his White House budget director, as his choice. The president has been an outspoken critic of the agency, calling it a "total disaster".

"Denying the president's authority to appoint Mr Mulvaney raises significant constitutional questions," said Judge Kelly, who was appointed by Mr Trump in Washington in September.

But he added there was nothing in the statutes that prevented Mr Mulvaney from holding both positions.

White House spokesman Raj Shah praised the ruling in a statement on Tuesday, saying it provided "further support for the president's rightful authority to designate Director Mulvaney as acting director of the CFPB".

Mr Mulvaney has previously called the CFPB a "sick, sad joke" that should be scrapped.

The CFPB was set up after the 2007 financial crash to protect Americans from predatory lenders. However, Republicans say it places excessive regulatory burdens on Wall Street.

Image copyright Getty Images Image caption Mick Mulvaney (second from right) has previously called for the bureau to be scrapped

Ms English's lawsuit, filed on Sunday, asked a judge at a federal court in Washington DC to issue a temporary restraining order against the appointment of Mr Mulvaney, arguing that the law states that as deputy director she is entitled to take power until the Senate can vote to confirm another director.

She also contended that Mr Mulvaney could not serve as the White House head of the Office of Management and Budget as well as the head of the independent financial watchdog agency.

In response, the White House said the president had the authority to appoint Mr Mulvaney under the Federal Vacancies Reform Act.

Image copyright Getty Images Image caption Consumer rights activists rallied outside the CFPB offices in Washington

One of the senators who helped set up the bureau, Elizabeth Warren, said she believed the legal dispute would continue to an appeals court.

"It's too important to everyone to let it rest at the district court," she told Reuters.

Ms Warren led a protest rally outside the CFPB offices in Washington on Tuesday, calling for Mr Mulvaney to step aside.

Mr Mulvaney - who turned up at the bureau on Monday morning carrying donuts for employees - sent another memo advising staff to ignore Ms English.

"Consistent with my email from yesterday," he wrote, "please disregard any email sent by, or instructions you receive from, Ms English when she is purporting to act as the Acting Director."