A 35-year-old Perth man has been sentenced to eight-and-a-half years jail over the seizure of cocaine worth up to $2.5 million.

Stephen Bradford Crowe was arrested after customs officers found more than five kilograms of cocaine inside a package in August last year.

The package was sent from America and was described as containing muscle growth accelerator.

Crowe, a mobile phone dealer, claimed he had agreed to pick up the package to try to pay off a drug debt he owed to his suppliers.

He pleaded guilty to charges of attempting to possess a marketable and commercial quantity of the drug.

The Supreme Court was told the cocaine had a street value of up to $2.5 million.

A further quantity of the drug found at Crowe's city apartment was estimated to be worth more than $100,000.

Crowe will have to serve five years and three months before he can released.