If the officer or person to whom a writ of habeas corpus is directed, refuses obedience to the command thereof, he shall forfeit and pay to the person aggrieved a sum not exceeding ten thousand dollars ($10,000), to be recovered by action in any court of competent jurisdiction.