In 1901 Deakin was elected to the first federal Parliament as MP for Ballaarat, and became Attorney-General in the ministry headed by Edmund Barton.
He was active, especially in drafting bills for the Public Service, arbitration and the High Court.
His second reading speech on the Immigration Restriction Bill to implement the White Australia policy was notable for its blatant racism, including arguing that it was necessary to exclude the Japanese because of their good qualities, which would place them at an advantage over European Australians.
His March 1902 speech in favour of the bill establishing the High Court of Australia helped overcome significant opposition to its establishment.

Deakin attempted to resign from cabinet in April 1902, writing two letters of resignation to Barton.
The primary cause was his opposition to the government's proposed 50% pay rise for MPs, but his wife had also been in poor health.
He wrote to Barton that "my retirement will be a relief from a strain which has been severe at times", and hoped to still assist the government as a backbencher.
Barton replied that his departure would "break my heart" and "wreck the ministry".
He agreed to drop the proposed pay rise and Deakin agreed to continue as a minister.

In May 1902, Barton left the country to attend the coronation of Edward VII and 1902 Colonial Conference.
Deakin served as acting prime minister until Barton's return in October 1902.
During this time he dealt with the resignation of Governor-General Lord Hopetoun over a salary dispute and conflict with the South Australian government over the external affairs power, which was resolved in favour of the federal government.
He also secured the passage of the Customs Tariff 1902, which the Senate had twice returned to the House with a series of proposed amendments.
In view of the urgent need for government revenue, Deakin successfully convinced the House and his fellow ministers to accept the amendments, but in a way that avoided setting a new constitutional precedent over money bills.

Deakin continued his efforts to establish a federal judiciary when parliament resumed in May 1903.
The government eventually passed a compromise bill, the Judiciary Act 1903, which established a High Court of three judges.
Concessions were made on the number of judges (three rather than five) as well as their salary and pension entitlements.
In July 1903, Deakin was tasked with securing the passage of the Conciliation and Arbitration Bill which had been drafted by Charles Kingston.
He made the second reading speech on the bill at short notice, following Kingston's surprise resignation from cabinet.
He argued the bill, which would introduce a compulsory arbitration scheme for industrial disputes, would "bring both employer and employee before the bar of a tribunal which would mete out even-handed justice".
However, in early September the government unexpectedly abandoned the bill.
The ALP, with the "mischievous support" of the opposition, had passed an amendment extending its provisions to state railway workers, which Deakin regarded as unconstitutional.
He received much of the criticism for the decision to withdraw the bill.
In 1901 Deakin was elected to the first federal Parliament as MP for Ballaarat, and became Attorney-General in the ministry headed by Edmund Barton. He was active, especially in drafting bills for the Public Service, arbitration and the High Court. His second reading speech on the Immigration Restriction Bill to implement the White Australia policy was notable for its blatant racism, including arguing that it was necessary to exclude the Japanese because of their good qualities, which would place them at an advantage over European Australians. His March 1902 speech in favour of the bill establishing the High Court of Australia helped overcome significant opposition to its establishment.
Deakin attempted to resign from cabinet in April 1902, writing two letters of resignation to Barton. The primary cause was his opposition to the government's proposed 50% pay rise for MPs, but his wife had also been in poor health. He wrote to Barton that "my retirement will be a relief from a strain which has been severe at times", and hoped to still assist the government as a backbencher. Barton replied that his departure would "break my heart" and "wreck the ministry". He agreed to drop the proposed pay rise and Deakin agreed to continue as a minister.
In May 1902, Barton left the country to attend the coronation of Edward VII and 1902 Colonial Conference. Deakin served as acting prime minister until Barton's return in October 1902. During this time he dealt with the resignation of Governor-General Lord Hopetoun over a salary dispute and conflict with the South Australian government over the external affairs power, which was resolved in favour of the federal government. He also secured the passage of the Customs Tariff 1902, which the Senate had twice returned to the House with a series of proposed amendments. In view of the urgent need for government revenue, Deakin successfully convinced the House and his fellow ministers to accept the amendments, but in a way that avoided setting a new constitutional precedent over money bills.
Deakin continued his efforts to establish a federal judiciary when parliament resumed in May 1903. The government eventually passed a compromise bill, the Judiciary Act 1903, which established a High Court of three judges. Concessions were made on the number of judges (three rather than five) as well as their salary and pension entitlements. In July 1903, Deakin was tasked with securing the passage of the Conciliation and Arbitration Bill which had been drafted by Charles Kingston. He made the second reading speech on the bill at short notice, following Kingston's surprise resignation from cabinet. He argued the bill, which would introduce a compulsory arbitration scheme for industrial disputes, would "bring both employer and employee before the bar of a tribunal which would mete out even-handed justice". However, in early September the government unexpectedly abandoned the bill. The ALP, with the "mischievous support" of the opposition, had passed an amendment extending its provisions to state railway workers, which Deakin regarded as unconstitutional. He received much of the criticism for the decision to withdraw the bill.
Alfred Deakin