In the landmark court case Marbury v. Madison, it was ruled that the courts have the power of judicial review - which is to declare a law unconstitutional.
The main function of the courts is to 'judge the law' - and make sure laws are constitutional.
Courts provide an important part of 'checks' on both Legislative (Congress) actions and those of the Executive Department.