George W Bush has signed legislation to build 700 miles of fencing along the US-Mexican border to prevent illegal immigration.

Republicans hope the legislation will give them an election-year boost as they try to head off a strong Democratic attempt to take control of the US Congress.

'We have a responsibility to secure our borders. We take this responsibility seriously,' Bush said in a signing ceremony in the White House Roosevelt Room.

Bush had long opposed supporting a bill that was limited to border enforcement, spending months in a failed attempt to persuade the US Congress to back a comprehensive measure that would include a guest worker program for illegal immigrants.

The Senate had approved a measure he preferred, but Republicans in charge of the US House of Representatives insisted on border enforcement only, feeling election-year heat from Americans upset about the impact of illegal immigration in their states.

In his remarks, Bush insisted a guest-worker program would ease pressure along the border, and said Americans must face the reality that millions of illegal immigrants already live in the US.