Switzerland's biggest bank, UBS, has agreed to buy its ailing rival Credit Suisse in an emergency rescue deal aimed at stemming financial market panic unleashed by the failure of two American banks earlier this month.

"UBS today announced the takeover of Credit Suisse," the Swiss National Bank said in a statement. "This takeover was made possible with the support of the Swiss federal government, the Swiss Financial Market Supervisory Authority and the Swiss National Bank," the central bank added.