When Robert J. diGrazia was considering leaving as Boston's police commissioner in 1976 to become Montgomery County's police chief, he was especially anxious to secure one condition before accepting the offer.

He would not come to the Washington suburb, he told Montgomery County officials, unless he could bring Philip H. Marks, the soft-spoken civilian who had been his chief assistant and adviser in three police departments the past seven years.

Both men came. Since then, it's been difficult to discern where diGrazia's duties leave off and Marks' work begins, and the relationship has become a source of underground controversy in the 770-member department. Many officers call Marks "The Shadow," and have complained privately that they believe Marks, the civillian, wields as much power as diGrazia, the policeman.

Some of the unrest was predictable. It stemmed from the natural aversion police officers have to taking directives from a civilian.

"Civilians in positions of power we had not been exposed to," said Maj. Thomas Thear, a diGrazia supporter. "Right away, when they heard the chief was bringing this guy down from Boston, a lot of the officers said, 'What's the matter with the chief? Isn't he smart enough to run the department by himself?'"

Beyond that, there has been jealousy over Marks' professional intimacy with the chief. As diGrazia and Marks portray it, their relationship is common among men in high administrative positions. It is based on a Tom Sawyer-Huck Finn dependence in which the top man needs to know someone will always be in his corner, no matter what.

diGrazia 50, sees Marks, 32, as someone who will help him fight "against the alligators," both in and out of the department.

It is also a dependence that thrives on the contrasts between the two by most accounts. A man like diGrazia, with a great deal of personal presence and charm and longing for the limelight, needs someone like Marks: coldly analytical, yet always willing to stay in the shadows.

"DiGrazia is Mr. Friendly," said one high ranking officer who is a critic and asked not to be named. "He's disarming. He tends to make you like him. But, in the background, Phil Marks is operating the management machinery."

"At times, when diGrazia would have to break people, Phil would be involved in the decisions," said Steve Dunleavy, diGrazia's media spokesman in Boston. "He (Marks) always looked at them analytically. The chief would get emotionally involved . . . He would become very excitable and would get quite angry.

"But I never saw Phil lose his temper."

Despite the way they interact at work, it is hard to imagine two men more different in their backgrounds, personel style and professional approach.

DiGrazia is an imposing 6-feet-4 and sports a frizzed hairstyle, open collar shirts with medallions, braclets and turtlenecks. He looks much younger than 50.

Marks, on the other hand, is 5-feet-7, has close-cropped prematurely gray hair, making him appear older than 32, and wears conservative suits with quiet ties.

While Marks knows relatively few police officers and never makes public speeches, diGrazia seems bent on winning attention by accepting all sorts of speaking requests, whether it be the Rockville Jewish Community Coffeehouse or the Harvard University Institute of Politics.

He also gained attention by calling most police chiefs "pet rocks" at a police foundations conference in 1976, by wearing a pig emblem in his lapel at public meetings, and with statements like, "Police officers are social workers with guns strapped to the sides."

In public, the chief adopts the amiable, accessible manner of a campaigning politican. Above all, he strives to discard the somewhat "untouchable" image police officers often Project, and to appear down-to-earth.

"People," diGrazia once told a group of Montgomery County parent activists, "are like tea bags. You don't know their strength until they get into hot water."

The son of Italian immigrants, diGrazia grew up in a solidly Italian neighborhood in San Francisco's marina district where, he says, he never had to speak English until he mixed neighborhood in the Bronx, went to school. Marks, on the other hand, was raised in an ethnically N.Y., where his Jewish family had already lived for four generations by the time he was born.

"My great-grandmother read the New York Times everyday . . . I considered myself more American than Jewish," he says.

And while the chief's life has moved in a jagged line - his college education was interrupted several times, he was divorced and remarried, and it wasn't until he was 30 that he finally decided on a police career - Marks' life has followed a far more traditional course.

He went straight from high school to college, to graduate school, marrying his high school sweetheart and fathering two daughters along the way. Each new job he took was always a little better than the last, always paid a litte more, and was always in administration, the field he had studied at the University of Missouri.

In Boston, while diGrazia hobnobbed with the other public officials, frequently attending the theater or ballet, his name appearing regularly on the society pages of the local newspapers, Marks kept the sort of low key social life he maintains now living in Rockville. His leisure activities include mainly dining out with his family, the chief or friends from his synagogue, and playing bridge.

Marks' often sardonic humor and his wisecracking manner have served only to enhance his reputation for arrogance among police officers. "He's the kind of guy who reads a book like 'Winning Through Intimidation' and takes it to heart," remarked one officer.

"I'm not arrogant," Marks says. "I just have a smart mouth."

Both Marks and diGrazia minimize the amount of power Marks holds in the department, although Marks is in charge of personnel, training, fiscal affairs, research and planning, community relations, crime prevention and media relations - all key areas that used to be controlled by the chief or a police major.

"What you end up perceiving is that I'm running the department, but that's not a fair assessment," says Marks, in his office adjacent to the chief's. "I've been with diGrazia for so long that people will come to me as sort of a sounding board. I'll tell them how I think (the chief) will react.

"For example, he'll say to me, 'I've got this or that problem to solve, what are the alternatives?' Or he'll say, 'I've decided to take this course of action. What do you think about it?' Sometimes the end result comes out sounding more like what he suggested. Sometimes it comes out sounding more like what I suggested."

From their first meeting in St. Louis County, Mo., in 1970, the two men said they could sense a compatability that would keep them together when diGrazia moved on to become Boston's police commissioner and then Montgomery's police chief. DiGrazia recalls how Marks, "though a kid," impressed him as someone who would carry out orders exactly as the chief wanted.

Marks was 25 at the time, had a master's degree in public administration and was working as assistant to the city manager in Webster Groves, Mo. The chief had yet to graduate from college and was not to earn his diploma until he was 40 as the Police commissioner in Boston.

For Marks, diGrazia was "at that point in my life, probably one of the most dynamic public officials I had ever met." Marks often points to diGrazia's dynamism, his charisma and his apparent public appeal as what he admires about the chief.