SCOTLAND'S most prominent human rights lawyer is facing ruin. At the high court in Edinburgh this week, three senior appeal judges will decide whether to find Aamer Anwar guilty of contempt of court. If they do, it could mean a fine, imprisonment or a referral to the Law Society of Scotland, which could effectively ban him from practising law. For Anwar, who has built a career on defending the underdog, the stakes could not be higher.

The contempt hearing - instigated by Lord Carloway, the judge at the trial last year of Glasgow student Mohammed Atif Siddique - is the first of its kind in the UK and as such will make legal history. Anwar lodged an appeal two weeks ago on behalf of Siddique, who was convicted on charges pertaining to the collection and dissemination of terrorist literature via websites that he ran. In September, Anwar described the verdict as "a tragedy for justice and for freedom of speech" and claimed his client had been "found guilty of what millions of young people do every day, looking for answers on the internet". Contentiously, he also alleged that Siddique's prosecution was "driven by the state" in an "atmosphere of hostility" following the Glasgow airport attack. In his notes, Lord Carloway countered that Anwar's remarks "appeared to be an unjustified attack on almost every area of the trial process, other than the defence" and that, rather than speaking for his client, his statements reflected his own "personal views" and "lacked any hint of objectivity".

It is not the first time Anwar has been in the firing line for something he has said but, in terms of consequence, it could be the worst. The wider issues thrown up by his case concern the right of solicitors to speak publicly after a trial, whether personally or on behalf of their clients, and the degree to which this should be allowed. Since November, the pressure has been building. Day by day. Week by week. As an outspoken campaigner, known for his vitriolic speeches, keeping silent has been the hardest part for Aamer Anwar. The countdown to the fight of his life starts here.

10 WEEKS TO GO FEBRUARY 22. GLASGOW UNIVERSITY HUSTINGS Anwar - who is standing for rectorship of Glasgow University - shares a stage with his rivals, the former Liberal Democrat leader Charles Kennedy and Green MSP Patrick Harvie. In private, just 10 minutes ago, he admitted that he couldn't face thinking about the ramifications should his contempt hearing go against him. Instead, his attention is trained on his belief that student representatives have already anointed Kennedy as their rector, denying the other candidates the right to hang posters in the hall. When he stands, he is less man than man-sized mosquito, half-starved and seeking blood. Kennedy in particular looks incredulous when Anwar describes the election process as "an indictment of democracy" in which the non-Kennedy camps are at a disadvantage. "I don't claim I can represent you from Westminster or even Fort William," he says. "But you have the right to an active campaigning rector, not some nostalgic ego trip." Kennedy's supporters gasp; a number of students applaud; some simply laugh. It's easy to see why people feel uneasy around Anwar: if this were a beach, he would be the scorpion waiting patiently in your shoe.

His accent is part Manchester, where he was born, part Liverpool, where he grew up, and part Glasgow, where he became an adult. Undulating sentences shoot out, lassoing everything from university job losses to the occupation of Iraq, from stealth and suicide bombers to the ills of student debt. His main thrust is that he will be a campaigning rector at Glasgow, just as he was a campaigning student there. In 1989, he fronted a campaign that would lead to the introduction of anonymous marking for dental students, successfully arguing that racial discrimination had until then played a part in exam results. He recounts the story - not for the first time - of how, in 1991, he was accosted by police while flyposting information in Glasgow's west end about a forthcoming student demonstration. "My face got slammed against the pavement until my teeth started to crumble," he says. "My head was pulled back again and I fell unconscious. I was dragged along the cobblestones by a policeman and a policewoman and when I came round my face was covered in blood, I couldn't feel my mouth. While I was screaming for help I was told that this was what happens to black boys with big mouths." In 1995, he successfully sued Strathclyde Police, winning £4200 following Scotland's first civil action alleging a racist attack by police. "I don't give a damn about my career," he snarls at one point during his speech. He should be elected rector, he says, for his record of "standing up for other people's rights without worrying about my own career". Kennedy will subsequently be elected and Anwar is secretly very worried about his career. He sits to applause, takes notes.

SEVEN WEEKS TO GO MARCH 15. STOP THE WAR DEMO. GLASGOW GREEN Wind whips words from an inadequate PA system amid pro-Palestine flags, communist sickles, and copies of the Socialist Worker. Anwar is on a roster of speakers that includes deputy first minister Nicola Sturgeon and the novelist AL Kennedy. His seven-week-old son Qais waits beside the stage; a placard in his buggy reads "Troops Out Of Iraq". It might as well read My First Rally, which this is, to the chagrin of Anwar's parents, who fear the event could descend into a riot. But Anwar is proud. Later he will talk at length about how Qais has given him "something that's mine, that's not polluted, where there are not any struggles or oppression". Still, the man who takes the microphone five years after the invasion of Iraq is spitting feathers. "I'm tired of our government's stance on civil liberties and how the Muslim community has to integrate into an authoritarian Britain," he says. "I will not swear allegiance to the Queen. Injustice will radicalise and recruit, just as it did with the IRA." His statement last September, following the conviction of Siddique, struck a similar note: "Young Muslims today live in a climate of fear no different to that experienced by the Irish community in the last century." While speaking, he looks down regularly at his son, his anger dampened briefly, then reignited.

SIX WEEKS TO GO MARCH 20. AAMER ANWAR & CO. CARLTON PLACE. GLASGOW Anwar sits in his legal office, surrounded by photographs and framed newspaper articles. One picture shows him in Glasgow's Western Infirmary shortly after his teeth were bashed in by the police, a disturbing expression on his blood-soaked face as if he is smiling. Another shows him with Thomas "TC" Campbell, whose murder conviction he saw quashed in 2004; in another, he is spitting on a car - presumably that of a scab - during the 1993 Timex factory strike in Dundee. Tommy Sheridan - who Anwar is representing in his current perjury case - is in the same picture. In yet another, he is standing with the parents of Surjit Singh Chhokar, a Sikh waiter murdered in 1998. Anwar - at that time studying law as a mature student - became the family's full-time campaigner and legal spokesperson after three men were acquitted of the murder.

His campaign for the family prompted two criminal inquiries and led to the 2001 Jandoo Report, which found there was "institutional racism" in the Scottish criminal justice system. The report also lambasted Anwar for misinterpreting the Chhokar family and for attempting "to interfere with the prosecution to the point where his actions jeopardised the case".

Anwar made his name with the Chhokar campaign, but was painted in some quarters as a maverick and mischief maker, a caricature that still holds sway among some. He said at the time that the legal establishment wanted to destroy him, that there were people bent on ending his career. For Anwar, the parallels with his current situation are obvious. "I remember saying during the Chhokar trial that I expected to have to look over my shoulder for the rest of my life," he says. "I'm well aware of the fact that anything I do will be scrutinised and checked 10 times over in comparison to anyone else, which means I've to work 10 times as hard as anyone else just to survive."

Prominent English human rights lawyers such as Gareth Peirce, Imran Khan and Michael Mansfield have publicly criticised the Scottish justice system for its handling of Anwar's contempt case, given that his comments were made after the verdict in the Siddique trial, and all three have been assisting in the preparation for his contempt hearing. His Scottish legal team comprises three lawyers and is headed by Paul McBride QC.

"I have to follow the advice of my lawyers on how to deal with this," he says. "It's always instinctive for me to punch back if I'm hit, but I can't punch back this time. I can't speak publicly about this or I'm just walking into a trap." His days currently start early, he says, and end late. The hours in between are often either sleepless or filled with troubled dreams. The prospect of prison or a hefty fine is bad enough but several other concerns plague him. "This is not the legal history I wanted to make," he says. "I'm gutted because I feel like I'm on the edge of a cliff again. For me it's the thought of the public humiliation, the fact I could set back the issue of freedom of speech or the right of defence lawyers to speak out on behalf of their clients." There are peaks, he says, and troughs. "Sometimes I'm petrified. Other times, I feel confident that I'm doing the right thing. That's the state of mind I prefer to be in because it makes me feel stronger. The easiest thing in a controversial case with a guilty verdict is to just walk out the back door at court but am I really supposed to bottle it because it's not comfortable for me to speak out?"

Beneath the professional bluster are personal considerations that colour Anwar's thinking. He struck out on his own in 2006 after six years with Beltrami Berlow Solicitors. He is not business-minded - his mother and sister help him with the books - but he is surviving as an independent lawyer. Also in 2006, he married Ifet, the woman who is now the mother of his infant son. "When I'm on my own I get dark thoughts about what this will mean for my family," he says. "Before, I could just say, What happens happens' but now I have to think about my wife and child. I'm mortgaged up to the hilt, I'm in a business, I've borrowed money. Potentially the hearing will mean everything falling apart but I can't allow that to happen." His parents, who live in Liverpool, have been supportive but not entirely sympathetic. "My dad said to me some months ago, Why can't you just shut up? You've got everything you wanted now so just shut up and play the game.' I told him that I didn't become a lawyer just to sit back and rest on my laurels." Anwar's office is situated on the same street as Glasgow's sheriff court, where he won his civil action against the police in 1995. "I remember walking out of that courtroom and telling my dad that I would come back to this street and work as a lawyer," he says. "He laughed and said, Well I hope so, son,' but he didn't believe me. Every time I put on the gown it's a dream come true and I don't want that to be taken away from me."

He repeats several times that he doesn't accept the type of clients he represents - terror suspects, asylum seekers - to win a popularity contest, that if he doesn't smile more in public it's because of the gravity of the issues he has to deal with. But even outside work, the nerves are beginning to fray. "I get extremely angry," he admits. "I can't be angry in court or around my staff so it all blows up at home, around my family and friends, and I can be a complete nightmare to be around." As the hearing date nears, his fears will only get worse, his anxieties greater. He has received considerable public support ahead of the hearing, and has a genuine interest in debating the wider issues his case throws up, but still feels like a canary in the coal mine. Several interconnected images recur when he describes himself, and often with an aura of martyrdom. "I'm pretty much out there on my own," he says. "A sacrificial lamb."

12 DAYS TO GO APRIL 17. ANWAR'S HOME. GLASGOW The anger, for a time, has abated. Anwar stands with rolled-up shirt sleeves in the large front room of his Glasgow home. He is smiling frequently, or at least more frequently than usual. As in his office, several press clippings are framed on the wall: one, noticeably, places him at Number 13 on a "most eligible bachelor" list, which presumably is a source of pride. An acoustic guitar, which he can't play, rests against a wall, a "prop" from his bachelor past. But those days are clearly gone. Ifet hands him baby Qais and Anwar bobs him up and down tenderly in his arms. The boy squeaks, grips his father's shirt.

A photo of Anwar as a baby, in which he looks placid, is balanced on a stereo speaker. But even as a child, he insists, his mouth would get him into trouble. "There would be arguments with other kids at school and I would end up getting punched in the face. It didn't matter how much of a kicking I got, I would just carry on saying things. I was an angry boy but it was pent-up frustration because of things like racial abuse in the school playground."

Anwar's parents came to Britain from Pakistan in 1966 when his father, Anwar, was 31 and his mother, Nargis, 18. Both came from wealthy backgrounds and were unconventional in that they married for love. Anwar senior had been a "jet set playboy type" who moved in the same circles as movie stars and once sold a carpet to prime minister Zulfikar Ali Bhutto; Nargis grew up surrounded by chauffeurs, servants and gardeners. Liverpool was a different kettle of korma. Nargis has worked for many years as a social work administrator and is now training to be a magistrate; Anwar senior has retired but once drove buses on double shifts to give Anwar and his sister Saiqa the chance of a private education. "It was bizarre because my dad was just a working-class guy but his ideas were Thatcherite because of the background he came from," says Anwar. "He would drop us off at school in the Ford Cortina. Walking home in my Liverpool Boys College uniform I would get abuse from kids on the street, and then abuse at school because I was the son of a bus driver." To avoid racist taunts, he tried to convince his peers that he was Spanish. It didn't work. A loner, he spent most of his time in the library reading everything other than the books he should have, while his sister worked towards a place at Cambridge.

The chip on his shoulder gradually developed into a "block of flats" but it wasn't until a working holiday to Chicago, when he was 22, that his rage became politicised. The story of Malcolm X, in particular, inspired him. (Today, a huge poster of the political icon with the quote "Liberate our minds by any means necessary" dominates Anwar's stairwell.) He explains that he had originally wanted to join the RAF as a pilot but was turned down after years of preparation due to poor eyesight. He came to Glasgow to study engineering instead, with a view to becoming an aircraft engineer. And then he visited the US. Living conditions in Chicago's black neighbourhoods were "worse than Pakistan" and, to the despair of his parents, he switched degrees to sociology, politics and philosophy.

As an activist, he claims he was already well known to police before his beating in 1991. "At one student demonstration, someone handed me a megaphone and I thought it was great," he recalls. "The cops grabbed me but people were chanting, Let him go'. I was just cocky. I must have been arrested five or six times and was in three different court trials." At 40, he sees no conflict between activism - such as leading a march of G8 protestors to Gleneagles in 2005 - and his professional role as a solicitor, but acknowledges that the duality gets up some people's noses. To borrow a legal image, it's hard to imagine Anwar standing blindfolded with the scales of justice in one hand. More likely he will be jumping on one of the scales to alter the balance, or to snap them from their chains entirely. "People might say there's a blurring of boundaries but why is that a problem?" he says. "Who says the law is impartial and objective? Who says a lawyer must adopt the views of the establishment? The establishment tends to be fairly right-wing, all male and all white, so how does that connect to me? I'm not white, I'm not fairly right-wing and I wasn't born with a silver spoon in my mouth. My role as a defence lawyer is to fight someone's corner. It's hypocritical to find a way of shafting someone behind closed doors and then to come out and say you're impartial."

He is interrupted by the flashing of his mobile phone. The ringtone is a recording of Qais crying at two days old and Anwar smiles broadly every time he hears it. Fatherhood has brought new perspective to his life. "I look at my son and realise what life is really about," he says. "I feel a sense of joy that I've never felt before - it came for the first time when I met Ifet and then again when I met my son. It's something I don't have to campaign about, that I don't have to prove - it's just unconditional love." Despite this, or maybe because of it, the nightmares about his predicament are getting worse. He says he is "incredibly lonely" and that it's hard for him to express what he really feels about his situation beyond the regular outbursts when his anger gets the better of him. In his maudlin moments, he slips into bitter regret. "I think of all the pain I've caused my family," he says. "The things I've put them through. I'm conscious that I've let them down because I've been incredibly self-centred, almost turning my own personal life into a campaign. The ones who are closest to me have always had to stand in a queue until something is done, and then there's always something else."

Naivety and idealism are among Anwar's key traits, even though they come with razor-sharp edges. He is like a terrier that might roll over, but could equally have your hand off. His inability to be gentle, he reckons, is a weakness to be worked on. When he is feeling philosophical about the contempt hearing - and it doesn't come naturally - he says he looks for the positives, that he has a lot still to learn as a lawyer, and that ideas change for the better through struggle. He is affronted that people refuse - increasingly he believes - to speak out about injustice, to stand up and be counted, and remains unafraid to challenge authority.

But it's in the cracks between the hyperbole, beneath all the talk of "the establishment" and right-wing conspiracies, that the real Aamer Anwar resides. "Sometimes when I walk into the common room at court I'm like that little boy at school again looking about and seeing no friends," he says. "It's a case of just go, get your stuff and get out of there."